title: Android: how to skip chooser dialog during sharing
body: <p>I want to send one image file from my custom keyboard. I want to skip chooser dialoge and send the photo during sharing from my custom keyboard.</p>
  
  <p>Below is my code</p>
  
  <p>String root_sd = Environment.getExternalStorageDirectory().toString();</p>
  
  <pre><code>            File imgFile = new  File(root_sd + "/My Photo/"+"Image-6260.jpg");
  
              Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
  
              sharingIntent.setType("image/png");
  
              sharingIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(imgFile));
              startActivity(Intent.createChooser(sharingIntent, "Share via"));
              startActivity(sharingIntent);
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/0b2kO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0b2kO.png" alt="enter image description here"></a></p>