我希望获得共享文本和图像,我发现应用程序包智能搜索然后共享应用程序明智的共享功能。
请帮忙。
注意:我只是想与链接共享文本。
感谢名单
答案 0 :(得分:2)
Intent intentIN = getPackageManager().getLaunchIntentForPackage("PACKAGE NAME");
if (intentIN != null) {
Intent shareIntentIN = new Intent();
shareIntentIN.setAction(Intent.ACTION_SEND);
shareIntentIN.setPackage("com.instagram.android");
try {
shareIntentIN.putExtra(Intent.EXTRA_STREAM, Uri.parse(MediaStore.Images.Media.insertImage(getContentResolver(), "", "I am Happy", "Share happy !")));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
shareIntentIN.setType("image/jpeg");
startActivity(shareIntentIN);
} else {
// bring user to the market to download the app.
// or let them choose an app?
intentIN = new Intent(Intent.ACTION_VIEW);
intentIN.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intentIN.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.instagram.android&hl=en"));
startActivity(intentIN);
}
请根据需要尝试此更改包名称。
答案 1 :(得分:0)
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, mUrl);
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, mTitle);
startActivity(Intent.createChooser(shareIntent, "Share XXX"));