0

I have an array of drawables that i want to send via share intent.

  public Integer[] mThumbIds = {
        R.drawable.ic_blue1,
        R.drawable.ic_blue2,
        R.drawable.ic_blue3,
        R.drawable.ic_blue4,
        R.drawable.ic_blue5,}

but share intent requires uris of all items that are being sent.How do i get uri of the items in this array?Is there a way to iterate through them and get uri?

enemy123
  • 43
  • 9
  • 1
    `I have an array of drawables`. No you have an integer array. – greenapps Feb 13 '17 at 14:05
  • Please show how you construct an uri for one of them. After that you can concentrate on having more than one. – greenapps Feb 13 '17 at 14:06
  • `Is there a way to iterate through them`. Iterate through an integer array array? Any problem doing so? – greenapps Feb 13 '17 at 14:08
  • Yes you are right.But Iterating through this is not an issue.Issue is getting uri address of all these resources dynamically,it would require iteration on items of array.To access items of an array we need to loop through them,and there should be a way to loop through these items and get there resource uri's dynamically.I am looking for that. – enemy123 Feb 13 '17 at 14:16
  • You are telleing nothing new. And you did not tell how tto get the uri for one of them. – greenapps Feb 13 '17 at 14:41
  • I've worked on couple of solutions given here,they do generate uri but i am getting a different exception.But they do generate uri http://stackoverflow.com/questions/4896223/how-to-get-an-uri-of-an-image-resource-in-android However there is still no help if i want to loop over an array of drawables and get all there uri's at given time. – enemy123 Feb 13 '17 at 17:09
  • As said before: you have an array of integers. And why do you refuse to show the code for getting one uri? It's not that difficult. – greenapps Feb 13 '17 at 17:54

1 Answers1

0

Solution is already present in below URL share image with URL android share intent.

Solution is typically converting the drawable resource to bitmap. Create ArrayList of Bitmaps. You can add all the data to Parcelable Array.

List<Bitmap> bitmapArray = new ArrayList();
for(int i=0;i<mThumbIds.size();i++) {
    bitmapArray.add(getLocalBitmapURI(mThumbIds.get(i));
}
Intent intent = new Intent(Intent.ACTION_SEND)
intent.putParcelableArrayListExtra("",bitmapArray);
Community
  • 1
  • 1