1
我想採用了android隱intents.So我的代碼發送圖像
發送圖像採用了android隱含意圖
Uri imageUri = Uri.parse("android.resource://com.example.intenttest/drawble/"+R.drawable.che3);
intent = new Intent(Intent.ACTION_SEND);
intent.setType("image/*");
intent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Image Sending");
intent.putExtra(android.content.Intent.EXTRA_TEXT, "I AM ATTACHED THIS IMAGE");
intent.putExtra(Intent.EXTRA_STREAM, imageUri);
chooser = Intent.createChooser(intent, "Send Image");
startActivity(chooser);
圖像的名字是che3.gif這是在繪製folder.And我與PNG格式也試過我讀了stackoverflow questions this和this我跟着第一個,但沒有用的。而它給像無法確定下面的MIME type.The的錯誤日誌貓
I/ActivityManager( 287): START u0 {act=android.intent.action.SEND typ=image/png flg=0x3000001 cmp=com.android.email/.activity.MessageCompose (has clip) (has extras)} from pid 2180
E/Email ( 749): Unable to determine MIME type for uri=android.resource://com.example.intenttest/drawble/2130837504
E/Email ( 749): java.lang.Error
E/Email ( 749): at com.android.emailcommon.utility.AttachmentUtilities.inferMimeTypeForUri(AttachmentUtilities.java:251)
E/Email ( 749): at com.android.email.activity.MessageCompose.loadAttachmentInfo(MessageCompose.java:1607)
E/Email ( 749): at com.android.email.activity.MessageCompose.addAttachmentFromSendIntent(MessageCompose.java:1674)
E/Email ( 749): at com.android.email.activity.MessageCompose.initFromIntent(MessageCompose.java:2028)
所以任何Ë請幫我
您不能將私人訪問的圖像附加到意圖公開與另一個應用程序。 –
可能的重複[圖像附件的郵件..如何在Android?](http://stackoverflow.com/questions/2518055/image-attachment-to-a-mail-how-in-android) –
感謝您的捐贈我回答,所以你可以請告訴我如何給繪製文件夾中的圖像授予權限。爲什麼因爲我添加了下面的行intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); [我從這裏得到](http://stackoverflow.com/questions/2518055/image-attachment-to-a-mail-how-in-android)但沒用 – prasad