[英]How to Share Image and text on hike application using Share Intent in android
我想在 android 中使用 ACTION_SEND 共享圖像和文本,我使用下面的代碼,我只能共享一個圖像,但我不能在遠足應用程序上與其共享文本。
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/*");
// share.setPackage("com.hike");
share.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject");
share.putExtra(Intent.EXTRA_TEXT, "Hello " + webView.getUrl());
/*
* if (text!=null){ share.putExtra(Intent.EXTRA_TEXT,text); } if
* (path!=null){ share.putExtra(Intent.EXTRA_STREAM,
* Uri.fromFile(new File(path))); }
*/
share.putExtra(Intent.EXTRA_STREAM, BitmapURLFromAssets.getBitmapFromAssets(MainActivity.this, "logo.png"));
try {
startActivity(Intent.createChooser(share, ""));
} catch (android.content.ActivityNotFoundException ex) {
FireToast.makeToast(MainActivity.this, "hike have not been installed.");
}
我想這個答案可能對你有幫助。 供參考徒步旅行的包裹名稱是
com.bsb.hike
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.