Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(picPathUriString)), "image/png");
startActivity(intent);
我在S2上运行它,它会像预期的那样使用图库打开图片,并显示该图库应用程序的所有功能(例如“共享”和“发送”..etc)。
为什么?怎样才能确保我得到了所有的选项?谢谢
发布于 2013-12-23 07:18:23
试试这个..。
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("image/png");
shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
Uri uri = Uri.parse(Uri.parse(picPathUriString));
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(shareIntent, "Share via"));
https://stackoverflow.com/questions/20738020
复制