I don't find a correct solution to post an image to my facebook wall using facebook sdk.
On stackOverflow I found the following solution but AsyncFacebookRunner and mAsyncRunner.request are deprecated and they don't work.
private Facebook facebook;
@SuppressWarnings("deprecation")
public void shareImg(View v) {
System.out.println("ciao");
Bitmap img = albero.getDrawingCache();
if (img != null) {
byte[] data = null;
Bitmap bi = img;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bi.compress(Bitmap.CompressFormat.JPEG, 100, baos);
data = baos.toByteArray();
Bundle params = new Bundle();
params.putString("method", "photos.upload");
params.putByteArray("picture", data);
AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook);
mAsyncRunner.request("me/posts", params, "POST", new SampleUploadListener(), null);
}
}
Any suggestions?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…