我想在我的Facebook墙上发布一些东西,但我不想使用默认的fb feed来发布一些东西而不是我想使用自定义编辑文本来帮助我在facebook墙上发布一些数据。
有没有办法这样做。
请告诉我。答案 0 :(得分:0)
Suppose If you want to post hello with a image..
public static void postOnWall(final Activity activity,Bitmap bitmap)
{
try
{
Session session = Session.getActiveSession();
if (session != null)
{
Bundle parameters = new Bundle();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
byte[] byteArray = stream.toByteArray();
if(bitmap!=null)
{
parameters.putByteArray("picture", byteArray);
parameters.putString("message", "hello");
}
Request request = new Request(session, "me/photos", parameters,HttpMethod.POST,new Request.Callback()
{
@Override
public void onCompleted(Response response)
{
Toast.makeText(activity, "picture shared successfully", Toast.LENGTH_SHORT).show();
}
});
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}