Ale*_*iev 3 android text share image android-intent
我知道可以ACTION_SEND通过指定来共享文本消息Intent.EXTRA_TEXT.相同的方法适用于图像 - Intent.EXTRA_STREAM.
但是,如何将文本和图像添加到同一意图中?
你可以通过意图发送文字和图像
如果您使用Intent ACTION发送,那么,
要仅发送文本或流使用的一个数据,
Intent intent = new Intent(Intent.ACTION_SEND);
要一次发送多个数据,请使用,
Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
通常从一个特定活动发送到任何其他特定活动,
发送
Bitmap bmp = "Your Bitmap";
String txt = "Text";
Intent intent = new Intent(ActivityName.this,SecondFile.class);
intent.putExtra("Text",txt);
intent.putExtra("Img",bmp);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
接收
Intent intent = this.getIntent();
String txt = intent.getStringExtra("Text");
Bitmap bmp = intent.getParcelableExtra("Img");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6146 次 |
| 最近记录: |