Here, you can find whatever I know and I want to learn; therefore, I also should to share and teach it here.
Wednesday, June 15, 2011
Friday, June 3, 2011
¿How to capture a screenshot programmatically ?
View myView = findViewById(R.id.form);
Bitmap bmp = Bitmap.createBitmap( myView.getMeasuredWidth() , myView.getMeasuredHeight() , Config.ARGB_8888);
Canvas canvas = new Canvas(bmp);
myView.draw(canvas);
try {
FileOutputStream out = new FileOutputStream( "/sdcard/screen.jpg" );
bmp.compress(Bitmap.CompressFormat.JPEG, 100, out);
out.flush();
out.close();
} catch (Exception e) {
e.printStackTrace();
}
Bitmap bmp = Bitmap.createBitmap( myView.getMeasuredWidth() , myView.getMeasuredHeight() , Config.ARGB_8888);
Canvas canvas = new Canvas(bmp);
myView.draw(canvas);
try {
FileOutputStream out = new FileOutputStream( "/sdcard/screen.jpg" );
bmp.compress(Bitmap.CompressFormat.JPEG, 100, out);
out.flush();
out.close();
} catch (Exception e) {
e.printStackTrace();
}
Subscribe to:
Posts (Atom)