Use a drawable with layer-list as if it was a normal image
<p>I am using an Intent to share an image, like elsewhere is explained on stackoverflow. Here is the code I stole from this site (thanks) :)</p>

<pre><code>private void share(String nameApp, String imagePath) {
    List&lt;Intent&gt; targetedShareIntents = new ArrayList&lt;Intent&gt;();
    Intent share = new Intent(android.content.Intent.ACTION_SEND);
    share.setType("image/jpeg");
    List&lt;ResolveInfo&gt; resInfo = getPackageManager().queryIntentActivities(share, 0);
    if (!resInfo.isEmpty()){
        for (ResolveInfo info : resInfo) {
            Intent targetedShare = new Intent(android.content.Intent.ACTION_SEND);
            targetedShare.setType("image/jpeg"); // put here your mime type

            if (info.activityInfo.packageName.toLowerCase().contains(nameApp) || 
                    info.activityInfo.name.toLowerCase().contains(nameApp)) {
                targetedShare.putExtra(Intent.EXTRA_TEXT,     "My body of post/email");
                targetedShare.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(imagePath)) );
                targetedShare.setPackage(info.activityInfo.packageName);
                targetedShareIntents.add(targetedShare);
            }
        }

        Intent chooserIntent = Intent.createChooser(targetedShareIntents.remove(0), getResources().getString(R.string.share_select));
        chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedShareIntents.toArray(new Parcelable[]{}));
        startActivity(chooserIntent);
    }
}
</code></pre>

<p>My problem is that I don't have any jpg to share, but I create the images, with drawables and layer-lists like this:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android" &gt;
    &lt;item android:drawable="@drawable/background01" /&gt;
    &lt;item android:drawable="@drawable/img02" /&gt;
    &lt;item android:drawable="@drawable/img07" /&gt;
&lt;/layer-list&gt;
</code></pre>

<p>I don't understand if and how I can use these drawables as they were full images and use them inside the share() function. Can some one please explain me?</p>

<p>Thank you in advance.</p>
