0

i have got screenshot code works fine with image, now i added surface view along with image. but takes shot with images and drawings. but doesn't take anything on surface view. please help me in this regard

here is screenshot code

public Bitmap takeScreenshot() {

       View rootView = null;
       rootView = getWindow().getDecorView().getRootView();
       rootView.setDrawingCacheEnabled(false);
       rootView.buildDrawingCache();
       rootView.setDrawingCacheEnabled(true);
       return rootView.getDrawingCache();
    }

     public void saveBitmap(Bitmap bitmap) {

        File imagePath = new     File(Environment.getExternalStorageDirectory() + "/" + new   SimpleDateFormat("yyyyMMddhhmmss'.jpg'").format(new Date()) );
        FileOutputStream fos =null;
        try {
            fos = new FileOutputStream(imagePath);
            bitmap.compress(CompressFormat.JPEG, 100, fos);
            fos.flush();
            fos.close();
            new   AlertDialog.Builder(DrawingActivity.this).setTitle("Info!").setMessage("New   Image Saved").setPositiveButton(android.R.string.ok, null).setCancelable(false).create().show();
        } catch (FileNotFoundException e) {
            Log.e("GREC", e.getMessage(), e);
        } catch (IOException e) {
            Log.e("GREC", e.getMessage(), e);
        }
    }
Nicola
  • 3
  • 2

0 Answers0