How can I take screenshot of selected area of phone-screen not by any program, but from code.
Asked
Active
Viewed 551 times
0
-
Check this link : http://stackoverflow.com/questions/2661536/how-to-programatically-take-a-screenshot-on-android – Kanika Mar 25 '14 at 10:47
-
Do the same as a normal screenshot, but remove the user input and "just do it". – Parrotmaster Mar 25 '14 at 10:47
-
http://stackoverflow.com/questions/6056000/android-screenshot-from-code-got-it-but-not-perfect Your answer is on the page above. – Kirk122 Mar 25 '14 at 10:49
-
Take a look here, hope it helps : http://stackoverflow.com/questions/2661536/how-to-programatically-take-a-screenshot-on-android – Brovoker Mar 25 '14 at 10:51
-
Hello i want to take screen shot of google map with markers on it but i am getting only blank screen. – Chetak Bhimani Mar 25 '14 at 10:57
1 Answers
0
// image naming and path to include sd card appending name you choose for file
String mPath = Environment.getExternalStorageDirectory().toString() + "/" + ACCUWX.IMAGE_APPEND;
// create bitmap screen capture
Bitmap bitmap;
View v1 = mCurrentUrlMask.getRootView();
v1.setDrawingCacheEnabled(true);
bitmap = Bitmap.createBitmap(v1.getDrawingCache());
v1.setDrawingCacheEnabled(false);
OutputStream fout = null;
imageFile = new File(mPath);
try {
fout = new FileOutputStream(imageFile);
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, fout);
fout.flush();
fout.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Then, when you need to access use something like this:
Uri uri = Uri.fromFile(new File(mPath));

BSK-Team
- 1,750
- 1
- 19
- 37