title: Image only Shared with Whatsapp but not with other apps in Android
body: <p>I am trying to share image using intent. Here is the method that i created </p>
  
  <pre><code>public void shareImg(int fileNum)    //Consider fileNum=R.drawable.img
  {
  
      Uri uri= Uri.parse("android.resource://"
              + context.getPackageName() + "/" + fileNum);
      Intent share=new Intent();
      share.setAction(Intent.ACTION_SEND);
      share.setType("image/*");
      share.putExtra(Intent.EXTRA_STREAM, uri);
      share.putExtra(Intent.EXTRA_TEXT, "Sent Via ---");
  
      Intent chooser= Intent.createChooser(share, "Share Via");
      context.startActivity(chooser);
  
  }
  </code></pre>
  
  <p>The image is shared properly with Whatsapp with caption. But when I try to share app with Gmail, Messenger, etc it gives error shown in Toast.</p>
  
  <p>For eg. </p>
  
  <p>Gmail says : Can't attach empty file</p>
  
  <p>Messenger says : Failed to convert to image</p>