List of usage examples for android.view ViewGroup getDrawingCache
@Deprecated
public Bitmap getDrawingCache()
Calling this method is equivalent to calling getDrawingCache(false)
.
From source file:Main.java
public static void prepare(Activity activity, int id, int width) { if (sCoverBitmap != null) { sCoverBitmap.recycle();// www . j a v a 2 s .c o m } Rect rectgle = new Rect(); Window window = activity.getWindow(); window.getDecorView().getWindowVisibleDisplayFrame(rectgle); int statusBarHeight = rectgle.top; ViewGroup v1 = (ViewGroup) activity.findViewById(id).getRootView(); v1.setDrawingCacheEnabled(true); Bitmap source = Bitmap.createBitmap(v1.getDrawingCache()); v1.setDrawingCacheEnabled(false); if (statusBarHeight != 0) { sCoverBitmap = Bitmap.createBitmap(source, 0, statusBarHeight, source.getWidth(), source.getHeight() - statusBarHeight); source.recycle(); } else { sCoverBitmap = source; } sWidth = width; }