2

I want to make a screenshot of the screen without saving the image, now I do this to make a screenshot:

View view = webView.getRootView();
view.setDrawingCacheEnabled(true);
Bitmap bitmap = Bitmap.createBitmap(view.getDrawingCache());
view.setDrawingCacheEnabled(false);
result = new PluginResult(PluginResult.Status.OK);

And to attach the image to the email:

i.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///INFINITA-PL.png"));

I do not know how to do it without path.

Toon Krijthe
  • 52,876
  • 38
  • 145
  • 202
user823415
  • 57
  • 1
  • 5

1 Answers1

2

The EXTRA_STREAM value has to be a Uri that can be opened by the Email process. If you don't want to save it as a file and pass that along you will need to implement a ContentProvider to make it accessible. In general this is pretty messy to do: I can echo the comments in that question (I struggled for awhile to do it without hitting the file system before giving up).

You're probably better served using a File and moving on to the rest of your app.

Community
  • 1
  • 1
Femi
  • 64,273
  • 8
  • 118
  • 148