Capture Screen in Android

Capturing screen is a very useful thing in lot of projects. We can use it for thumbnail, in some cases can use it for Animations etc. This post mainly shows the power of setDrawingCacheEnabled() method in Android's View class. Most common use is take the screen shot and use it as a thumbnail. Take a view from the layout xml file and use the code snippet,

TextView tv = (TextView) findViewById(;
View img = (View) findViewById(;
img = tv.getRootView();
Bitmap bmp = img.getDrawingCache();
ImageView image = (ImageView) findViewById(;


Popular posts from this blog

Open Gallery and get the selected image in appplication

Dismiss or Cancel dialog by swipe gesture

AlarmManager and Notification in Android