public void captureImage() { //captures screen image String Path = Environment.getExternalStorageDirectory().toString() + "/"; //+ ACCUWX.IMAGE_APPEND; Bitmap bitmap; View v1 = getWindow().getDecorView().getRootView(); v1.setDrawingCacheEnabled(true); bitmap = Bitmap.createBitmap(v1.getDrawingCache()); v1.setDrawingCacheEnabled(false); OutputStream out = null; File imageFile = new File(Path); try { out = new FileOutputStream(imageFile); bitmap.compress(Bitmap.CompressFormat.JPEG, 90, out); out.flush(); out.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
NullPointerException
Bitmap.createBitmap(v1.getDrawingCache())
`View v1 = mCurrentUrlMask.getRootView();`
`View v1 = getWindow().getDecorView().getRootView();`