在android中我無法以jpeg和png格式共享圖片。請幫忙糾正我的代碼在Android中分享圖片的錯誤
每當我的共享代碼它給
這是我的代碼例外「不支持的文件格式」:
Uri imageUri = Uri.parse("android.resource://com.parekh.shareimage/drawable");
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT, "My sample image text");
shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
shareIntent.setType("image/*");
startActivity(shareIntent);
該代碼指向一個目錄 – Chisko
除此之外,相對較少的應用程序處理'android.resource'方案好。而且,並非每個應用都會處理*'EXTRA_TEXT' *和*'EXTRA_STREAM'。 – CommonsWare
請更正我的代碼 – Parekh