in my application i want to capture screen which is with surfaceview but i am not able capture screen on which is drawn with background.how to save the screen with drawn along with background.please help me how to solve this issue.
View content = findViewById(R.id.relative21);
content.setDrawingCacheEnabled(true);
SurfaceHolder sfhTrack = drawingSurface.getHolder();
sfhTrack.setFormat(PixelFormat.TRANSPARENT);
private void getScreen() {
// TODO Auto-generated method stub
View content = findViewById(R.id.relative21);
Bitmap bitmap = content.getDrawingCache();
File myDir=new File("/sdcard/saved_images");
myDir.mkdirs();
Random generator = new Random();
int n = 10000;
n = generator.nextInt(n);
String fname = "Image-"+ n +".png";
File file = new File (myDir, fname);
try
{
FileOutputStream ostream = new FileOutputStream(file);
bitmap.compress(CompressFormat.PNG, 100, ostream);
ostream.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
i tried above code i am able to save background but i am not able save which is drawn.