/**
* Activity Bitmap
*/
private Bitmap takeScreenShot(Activity activity) {
View view = activity.getWindow().getDecorView();
view.setDrawingCacheEnabled(true);
view.buildDrawingCache();
Bitmap b1 = view.getDrawingCache();
Rect frame = new Rect();
activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
int statusBarHeight = frame.top;
int width = activity.getWindowManager().getDefaultDisplay().getWidth();
int height=activity.getWindowManager().getDefaultDisplay().getHeight();
Bitmap b = Bitmap.createBitmap(b1, 0, statusBarHeight, b1.getWidth(), height
- statusBarHeight);
view.destroyDrawingCache();
return b;
}
/**
* bitmap sd
* @param bitmap
* @param strFilePath
*
*/
private void savePic(Bitmap bitmap, String strFilePath) {
FileOutputStream fos = null;
try {
fos = new FileOutputStream(strFilePath);
if (null != fos) {
bitmap.compress(Bitmap.CompressFormat.PNG, 90, fos);
fos.flush();
fos.close();
File file=new File(strFilePath);
this.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,Uri.fromFile(file)));
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}