试试下面的代码,并检查你的位图不应该为空..
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);