-3

I have two android applications created via android studio. From application1, I try to send a picture to application2 and view it.

For this, from app1 one I passed the image via intent to application2 as follows:

Intent imgIntent = new Intent();
imgIntent .setAction(Intent.ACTION_SEND);
Uri uriToImage = Uri.parse("android.resource://com.example.appname/" + R.drawable.pic_png);
    imgIntent .putExtra(Intent.EXTRA_STREAM, uriToImage);
    imgIntent .setType("image/*");//image/jpeg
    startActivityForResult(imgIntent , REQUEST_CODE);

How can I view the image sent via intent in application2 ? If we send a text, we can get it as:

getIntent().getExtras().getString("textvalue");

I am a newbie in android platform. Please help me.Thanks in advance...

AngularDoubts
  • 459
  • 2
  • 11
  • 30
  • Check [this](http://infobloggall.com/2015/04/14/communication-between-two-applications-in-android-using-messenger) and [this](http://stackoverflow.com/a/4639166/3967525) – Soham Oct 06 '16 at 11:08

1 Answers1

1
Uri stream=(Uri)getIntent().getParcelableExtra(Intent.EXTRA_STREAM);

Then, pass that Uri to your favorite image-loading library, like Picasso.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491