Created
October 11, 2013 10:39
-
-
Save marijnvdwerf/6932758 to your computer and use it in GitHub Desktop.
ScreenshotActivity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onWindowFocusChanged(boolean hasFocus) { | |
super.onWindowFocusChanged(hasFocus); | |
View rootView = findViewById(R.id.root); | |
rootView.setDrawingCacheEnabled(true); | |
Bitmap b = rootView.getDrawingCache(); | |
try { | |
b.compress(Bitmap.CompressFormat.PNG, 95, new FileOutputStream("/sdcard/screen.png")); | |
} catch (FileNotFoundException e) { | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment