Search code examples
androidandroid-layoutandroid-emulatorandroid-widgetandroid-gallery

How to share the Image of the ImageView?


I am Using this code to Share the Image that is already available in to My SDCard:

Intent picMessageIntent = new Intent(android.content.Intent.ACTION_SEND);   
picMessageIntent.setType("image/jpeg");   
//File downloadedPic =  new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS),"q.jpeg");   
//picMessageIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(downloadedPic));

File f = new File(lastPath);
picMessageIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f));
startActivity(picMessageIntent);
//finish();

But, Instead of that i want to use the ImageView Image file that i have set to the Imageview. And Want to Share that file. Then how it is possible to get File from ImageView and send to share with the above code ??

Thanks.


Solution

  • You can use ACTION_SEND_MULTIPLE and include a list of images an an ArrayList<Parcelable> and use putParcelableArrayListExtra() to store it. Gallery does this and would be a good reference.

    (answer snagged from http://groups.google.com/group/android-developers )