1

I want to take screenshot of my WebView by clicking on menu item . And then I want to draw on this screenshot and save it on my sdcard.

I've also found the solution of taking screenshot and saving. Here it is:

private void getScreen(View content) {

Bitmap bitmap = content.getDrawingCache();
    File file = new File("/sdcard/screen.png");
    try {
        file.createNewFile();
        FileOutputStream ostream = new FileOutputStream(file);
        bitmap.compress(Bitmap.CompressFormat.PNG, 100, ostream);
        ostream.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

and on onOptionsItemSelected() method:

 View content = findViewById(R.id.webview_main);
                content.setDrawingCacheEnabled(true);
                getScreen(content);

It`s work ok, but I want to implement drawing on it too. If anyone know, how to do this, tell me please, I will be very grateful.

androiddev
  • 35
  • 7
  • 1
    Make a custom image view that implements finger paint. Set your screenshot in that imageview and take screenshot again. http://stackoverflow.com/questions/15704205/how-to-draw-line-on-imageview-along-with-finger-in-android – Developer Dec 15 '16 at 09:28
  • @Developer, thanks a lot for your answer. When i take a screenshot, it doesn`t show on screen, I also saves on sdcard. So, I must to take this screenshot from sdcard and draw on it? Is it the best solustion? – androiddev Dec 15 '16 at 09:48
  • @androiddev, no you have to show bitmap directly in image view. – Developer Dec 15 '16 at 09:52
  • @Developer ok,thanks, i`ll try – androiddev Dec 15 '16 at 09:55

0 Answers0