How to make skinšote?

You need to make a screenshot with your surface and imposed on her bitmap
He get bitmap like this:
public static Bitmap captureScreen(View v) { 
Bitmap screenshot = null; 
try { 

if(v!=null) { 

screenshot = Bitmap.createBitmap(V. getMeasuredWidth(),V. getMeasuredHeight(), Bitmap.Config.ARGB_8888); 
Canvas canvas = new Canvas(screenshot); 
v.draw(canvas); 
} 

}catch (Exception e){ 
Log.d("DalActivity", "Error:" + e.getMessage()); 
} 

return screenshot; 
}

save the image:
public static void saveImage(Bitmap bitmap) throws IOException{ 
Time time = new Time(); 
time.setToNow(); 
//ByteArrayOutputStream bytes = new ByteArrayOutputStream(); 
//bitmap.compress(Bitmap.CompressFormat.PNG, 100, bytes); 
File f = new File(Environment 
.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),Integer.toString(time.year) +"."+ Integer.toString(time.month) +"."+ Integer.toString(time.monthDay) +" "+ Integer.toString(time.hour) +":"+ Integer.toString(time.minute)+":" + Integer.toString(time.second) + ".png"); 
//f.createNewFile(); 
FileOutputStream fo = new FileOutputStream(f); 
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fo); 
//fo.write(bytes.toByteArray()); 
fo.close(); 

}

But when saving get a picture without the background bitmap is drawn. What to do?
July 9th 19 at 11:21
0 answer

Find more questions by tags Android