我想通過我的應用程序在Android上使用Facebook Api將圖像上傳到我朋友的帳戶/牆上。 我可以將圖片上傳到我的帳戶,但現在我正在努力使其更加實用,並嘗試將圖片上傳到我通過Android應用程序選擇的朋友牆/帳戶上。 我試圖做到這一點,但沒有成功。 PLZ幫我... 由於提前在Facebook上通過Android上傳朋友牆/帳戶中的圖片
0
A
回答
1
使用此代碼在您的方法
File file=new File(murl);
InputStream is;
try {
is = new FileInputStream(file);
Drawable d;
long length = file.length();
if (length > Integer.MAX_VALUE) {
// File is too large
}
byte[] bytes = new byte[(int)length];
ByteArrayOutputStream bout=new ByteArrayOutputStream();
// Read in the bytes
int offset = 0;
int numRead = 0;
while (offset < bytes.length
&& (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
offset += numRead;
}
bout.write(bytes);
bout.flush();
//Bitmap bm=BitmapFactory.decodeByteArray(bytes,0,bytes.length);
//d=new BitmapDrawable(bm);
//mPostButton.setBackgroundDrawable(d);
//p.putString("to","1300750213");
//p.putString("caption","my card");
EditText title_txt=(EditText) findViewById(R.id.fb_upload_txt);
for(int i =0;i<frnd_list_id.length/2;i++){
if(frnd_list_id[i]!="0"){
Bundle p=new Bundle();
p.putString("method","photos.upload");
p.putString("caption",title_txt.getEditableText().toString());
p.putByteArray("picture",bytes);
System.out.println(frnd_list_id[i].trim());
p.putString("target_id",frnd_list_id[i].trim());
mAsyncRunner.request(null,p,"POST",new WallPostRequestListener(),null);
}
}
//System.out.println("hi");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
2
使用此鏈接爲Facebook 的所有集成它是由Facebook開發推薦..
http://developers.facebook.com/docs/guides/mobile/android_hackbook/
Regards ... Mehul Patel
相關問題
- 1. 通過Android應用發佈消息在Facebook朋友的牆上
- 2. 帖子上傳Facebook的視頻朋友的牆通過IOS SDK
- 3. Android:朋友牆上的Facebook圖片共享問題
- 4. 將照片上傳到朋友牆
- 5. 使用Facebook SDK在朋友的牆上張貼圖片
- 6. 發佈在facebook上的朋友牆
- 7. Facebook iOS SDK 3.1在朋友牆上張貼圖片錯誤
- 8. 在朋友的牆上張貼照片?
- 9. 通過Facebook發佈在朋友牆上Actionscript 3 SDK
- 10. Facebook Graph API在朋友牆上張貼
- 11. Facebook API:發佈在朋友牆上
- 12. Android如何將圖片發佈到朋友的牆上用facebook android sdk
- 13. 安卓朋友牆上的Facebook貼子
- 14. Facebook的Javascript fb.ui活動發佈在朋友牆上的照片?
- 15. Facebook:在朋友的牆上張貼一張照片
- 16. 如何發佈消息在facebook上的朋友牆在android
- 17. 發佈在用戶的朋友的牆上與Facebook
- 18. Facebook照片分享給朋友的牆
- 19. 通過Facebook應用程序發佈在Facebook朋友的牆上不起作用
- 20. 如何發佈在我的Facebook牆上通知一些朋友?
- 21. 我如何使用Android發佈在朋友的Facebook牆上
- 22. 發佈在朋友的facebook牆上使用android
- 23. 在Facebook朋友的牆上張貼限制與開放圖api
- 24. 上傳圖片和標籤朋友
- 25. 發佈在朋友的牆上使用PHP的Facebook的Facebook
- 26. 如何在朋友的牆上張貼圖片+文字
- 27. 如何發佈在Facebook上的朋友牆上?
- 28. 如何發送信息到Facebook朋友的牆上android SDK 3.0
- 29. 如何在Android的發佈消息在Facebook上的朋友牆上
- 30. Facebook上的朋友和朋友列表
從w我明白,你最終會同時觸發'frnd_list_id.length/2'同時所有人向Facebook發送請求。猜測這可能是更好的策略來實現你自己的Thread,你可以同時多次同時調用'Facebook.request(...)'。 – harism 2011-05-14 21:03:41