Android How to send text and images or any object using intent?
android, android-intent, image, share, text
Solution
you can send text and image via intent like
If you are sending using Intent ACTION then,
To send only one data either text or stream use,
`Intent intent = new Intent(Intent.ACTION_SEND);`
To send more then one data at a time use,
`Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);`
Normally to send from one specific Activity to any another specific activity,
Send
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);
Receive
Intent intent = this.getIntent();
String txt = intent.getStringExtra("Text");
Bitmap bmp = intent.getParcelableExtra("Img");
Problem
I know it's possible to share a text message with `ACTION_SEND` by specifying `Intent.EXTRA_TEXT`. Same approach works for images - `Intent.EXTRA_STREAM`. But how can I add both text and image to the same intent?