我想在谷歌上分享一张图片,应该很容易,但不是:-(
File rootSdDirectory = Environment.getExternalStorageDirectory();
File pictureFile = new File(rootSdDirectory, "attachment.jpg");
Log.e(TAG , "pictureFile.absolutePath = " + pictureFile.getAbsolutePath());
Log.e(TAG , "pictureFile.length = " + pictureFile.length());
Uri pictureUri = Uri.fromFile(pictureFile);
Intent shareIntent = ShareCompat.IntentBuilder.from(getActivity())
.setText("Hello from Google+!").setType("image/jpeg")
.setStream(pictureUri).getIntent()
.setPackage("com.google.android.apps.plus");
startActivity(shareIntent);
意图开始了,文字在那里,但不是图片。来自 android 系统的 toast 显示:“无法将所有媒体项附加到帖子”
当我在谷歌上搜索此错误消息时,我只发现了这个:
http://code.google.com/p/android/issues/detail?id=31442
有人有解决方案吗?
谢谢