3

I am trying to take a screen shot while recording a video. I can able to take screenshot and save it to my SD card. But it displays blank image on Sd card. Can anybody please help me to get out of this?

I am using below code to capture a screen shot:

        View v1 = cameraView; // CameraView is object of SurfaceView

        v1.setDrawingCacheEnabled(true);
        Bitmap bm = Bitmap.createBitmap(v1.getDrawingCache());
        OutputStream outStream = null;
        File file = new File(Environment.getExternalStorageDirectory(),        "test12345658.jpeg");
        try {
         outStream = new FileOutputStream(file);
         bm.compress(Bitmap.CompressFormat.JPEG, 100, outStream);
         outStream.flush();
         outStream.close();

         Log.i("Hub", "OK, Image Saved to SD");
         Log.i("Hub", "height = "+ bm.getHeight() + ", width = " + bm.getWidth());

        } catch (FileNotFoundException e) {

         e.printStackTrace();
         Log.i("Hub", "FileNotFoundException: "+ e.toString());

        } catch (IOException e) {

         e.printStackTrace();
         Log.i("Hub", "IOException: "+ e.toString());
        }
Vaghani.Rahul
  • 354
  • 1
  • 10
  • Take a look here: http://stackoverflow.com/questions/13122134/take-camera-screenshot-while-recording-like-in-galaxy-s3 – dor506 Oct 30 '12 at 19:46

0 Answers0