title: Send image to Android Message app
body: <p>I have a custom keyboard, where I need to send an image instead of text (preferably only if the user is in the message app)... But I'm a bit unsure of how to specifically send the image to the current app/activity...</p>
  
  <p>So what I have right now is that when the user clicks on one of my images in my custom keyboard, I run the following:</p>
  
  <pre><code>Drawable mDrawable = ResourcesCompat.getDrawable(getResources(), R.drawable.rsz_emoji, null);
  Bitmap mBitmap = ((BitmapDrawable)mDrawable).getBitmap();
  String path = MediaStore.Images.Media.insertImage(getContentResolver(), mBitmap, "Emoticon", null);
  
  Intent picMessageIntent = new Intent(Intent.ACTION_SEND);
  picMessageIntent.putExtra(Intent.EXTRA_STREAM, path);
  picMessageIntent.setType("image/jpeg");
  Intent new_intent = Intent.createChooser(picMessageIntent, "Share via");
  new_intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  startActivity(new_intent);
  </code></pre>
  
  <p>So this opens up the share popup, but ideally, what I want is to add the image to the message... So does anyone know what approach can give me the desired effect?</p>