2013-05-15 67 views
0

我想分享圖片和文字。 當我這樣做:如何將圖片和文字分享到Facebook應用程序

Intent share = new Intent(Intent.ACTION_SEND); 
     share.setType("image/*"); 
     ByteArrayOutputStream bytes = new ByteArrayOutputStream(); 
     screenshot.compress(Bitmap.CompressFormat.JPEG, 100, bytes); 
     File f = new File(Environment.getExternalStorageDirectory() 
       + File.separator + "temporary_file.jpg"); 
     try { 
      f.createNewFile(); 
      FileOutputStream fo = new FileOutputStream(f); 
      fo.write(bytes.toByteArray()); 
     } catch (IOException e) { 
      e.printStackTrace(); 
     } 
     share.putExtra(Intent.EXTRA_STREAM, 
       Uri.parse("file:///sdcard/temporary_file.jpg")); 
     share.putExtra(android.content.Intent.EXTRA_TEXT, textToShare); 
     startActivityForResult(Intent.createChooser(share, "Share Image"), 
       FROM_SHARE); 

它適用於所有的應用程序馬麗娟(即從如Gmail彈出的對話框choosen),除了臉譜,Facebook的只需要圖像而不是文字。 有沒有可以將額外的文字圖像傳遞給Facebook應用程序? 謝謝!

+1

Is this [this](http://stackoverflow.com/questions/5214764/how-to-share-photo-with-caption-via-android-share-intent-on-facebook)你在找什麼? – James

+0

是的,但解決方案不適合我... – roiberg

回答

4

FACEBOOK中有一個錯誤我有同樣的問題如果你真的想這樣做,你需要使用Facebook SDK,並使用Facebook ShareDialog。

相關問題