2014-11-06 29 views
2

我使用Android的面料sdk。 作出的所有作爲樣本:用於高音揚聲器後端的面料SDK

TweetComposer.Builder builder = new TweetComposer.Builder(this) 
      .text(((TextView) findViewById(R.id.tvMSG)).getText().toString()); 

      if (imgFileName!=null && !imgFileName.equals("")) { 
       builder.image(Uri.parse(imgFileName)); 
      } 

      builder.show(); 

其中imgFileName是在互聯網的鏈接,圖像(http://b2b4trade.com/images..../2.jpeg例如) 但當.show執行我看到作曲家用我的文字,但我沒有看到圖像。所以我的問題是 - 如何用圖像撰寫推文?

回答

1

鑑於TweetComposer使用Intent進行共享,您設置爲參數的圖像URI必須來自本地圖像。因此,在共享之前,您需要將圖像保存到本地磁盤。

這個問題討論了一個解決方案:android share image from url

此外,檢查本教程的「共享遠程圖像」一節:https://github.com/codepath/android_guides/wiki/Sharing-Content-with-Intents

也請記住,如果用戶沒有安裝Twitter的應用程序在設備上,TweetComposer將回退到Web Intent,在這種情況下,無法共享圖像,而無法構建上述解決方案。