2015-07-21 34 views
0

我正在嘗試構建消息應用程序活動。我想打開消息應用程序中附加的圖像,但我的消息應用程序正在停止。我已經設置了所有必需的權限。下面是我的代碼:打開帶有圖像的消息應用程序

Intent sendIntent = new Intent(Intent.ACTION_SEND); 
    sendIntent.putExtra("sms_body", "some text"); 
    Uri path = Uri.parse("android.resource://com.works.vipul.imageinmms/"R.drawable.images); 
    sendIntent.putExtra(Intent.EXTRA_STREAM, path); 
    sendIntent.setType("image/png"); 
    startActivity(Intent.createChooser(sendIntent,"Send")); 
+0

看起來像uri是錯誤的http://stackoverflow.com/questions/6602417/get-the-uri-of-an-image-stored-in-drawable – Xjasz

+0

該Uri是正確的,因爲它的顯示圖像是假設代表在android工作室的側欄 –

+0

「android.resource://com.works.vipul.imageinmms/drawable/images」<-------使用它並確保它是一個PNG – Xjasz

回答

1
com.works.vipul.imageinmms/" + R.drawable.images); 

添加 「+」。如果這不起作用,請發佈崩潰的堆棧跟蹤。

相關問題