尝试下面的代码,并检查您的位图切忌空..
Bundle bundle = new Bundle();
bundle.putString("message", "post image..");
byte[] data = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
<<your bitmap>>.compress(Bitmap.CompressFormat.JPEG, 100, baos);
data = baos.toByteArray();
bundle.putString(Facebook.TOKEN, facebook.getAccessToken());
bundle.putString("method", "photos.upload");
bundle.putByteArray("picture", data);
bundle.putString("message", "post image..");
mAsyncRunner.request(null,bundle,"POST",new RequestListener() {
@Override
public void onMalformedURLException(MalformedURLException e, Object state) {
Log.d("request RequestListener", "debug onMalformedURLException");
}
@Override
public void onIOException(IOException e, Object state) {
Log.d("request RequestListener", "debug onIOException");
}
@Override
public void onFileNotFoundException(FileNotFoundException e, Object state) {
Log.d("request RequestListener", "debug onFileNotFoundException");
}
@Override
public void onFacebookError(FacebookError e, Object state) {
Log.d("request RequestListener", "debug onFacebookError");
}
@Override
public void onComplete(String response, Object state) {
Log.d("request RequestListener", "debug onComplete");
}
}, null);
请参阅http://stackoverflow.com/questions/8710515/reading-an-image-file-into-bitmap-from-sdcard – ozbek 2013-05-08 06:42:43
可以请您分享fb共享的其余代码。我需要做同样的工作,仍然没有得到解决方案 – 2014-01-22 02:03:04