-1
我有麻煩從我的應用程序共享圖像到其他應用程序。從Android應用程序共享圖像
問題是當我分享圖像時,它不包括擴展程序和其他應用程序,比如messenger,whatsapp或gmail不能識別它們。
我的代碼是:
Intent intent = new Intent(Intent.ACTION_SEND);
String path = "android.resource://com.xxxx.xxxxxxx/drawable/image";
Uri screenshotUri = Uri.parse(path);
intent.putExtra(Intent.EXTRA_TEXT, "Hello world!");
intent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
intent.setType("image/*");
startActivity(Intent.createChooser(intent, "Share:"));
我有同樣的問題,共享音頻:
Intent share = new Intent();
share.setAction(Intent.ACTION_SEND);
String sharePath = "android.resource://com.xxx.xxxxx/raw/" + sound;
Uri uri = Uri.parse(sharePath);
share.putExtra(Intent.EXTRA_STREAM, uri);
share.setType("audio/mp3");
Intent i = Intent.createChooser(share, "Share Sound File");
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
baseContext.startActivity(i);
我已經簽了正式文件,可是仍然存在問題:https://developer.android.com/training/sharing/send.html
感謝幫助或任何提示!
檢查了這可能有所幫助 - http://stackoverflow.com/questions/7661875/how-to-use-share-image-using-sharing-intent-to-share-images-in-android https ://guides.codepath.com/android/Sharing-Content-with-Intents –