【发布时间】:2014-05-09 06:21:35
【问题描述】:
我正在尝试发布图片、消息、标题、链接。预计剩余的图片可以正常发布。 如果我提供图片的网址,它可以工作。但我想发送可绘制的图片。图片没有发布 我试过下面的代码:
class LoginDialogListener implements DialogListener {
public void onComplete(Bundle values) {
publishFeedDialog();
}
public void onFacebookError(FacebookError error) {
showToast("Authentication with Facebook failed!");
finish();
}
public void onError(DialogError error) {
showToast("Authentication with Facebook failed!");
finish();
}
public void onCancel() {
showToast("Authentication with Facebook cancelled!");
finish();
}
}
private void publishFeedDialog() {
final Bundle params = new Bundle();
final Bitmap bit=BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bit.compress(CompressFormat.JPEG, 100, baos);
byte[] data = baos.toByteArray();
params.putString("to", Universal.ids);
params.putString(Facebook.TOKEN, facebook.getAccessToken());
params.putString("name", "Sending a birthday card!");
params.putString("link", "https://play.google.com/store/search?q=dbgr&c=apps&hl=en");
params.putString("description", "Wishing You a HAPPY BIRTHDAY");
params.putString("picture", data);
facebook.dialog(this, "feed", params, new DialogListener() {
@Override
public void onFacebookError(FacebookError e) {
// TODO Auto-generated method stub
showToast("Authentication with Facebook failed!");
finish();
}
@Override
public void onError(DialogError e) {
// TODO Auto-generated method stub
showToast("Authentication with Facebook failed!");
finish();
}
@Override
public void onComplete(Bundle values) {
// TODO Auto-generated method stub
showToast("Post is successfully sent");
finish();
Intent i=new Intent(getApplicationContext(),FrndActivity.class);
startActivity(i);
}
@Override
public void onCancel() {
// TODO Auto-generated method stub
showToast("Authentication with Facebook cancelled!");
finish();
}
});
图片没有发布。请帮助我。
【问题讨论】:
标签: android facebook-graph-api bitmap facebook-android-sdk android-facebook