开发者

How to take a screen shot in android

I want to take a screen shot in android irrespective of the application and without rooting the phone. I have seen into the previous thread link I followed t开发者_StackOverflow社区his instructions but they are specific to one application. And we need to change the layout file of every application.

I also came across the link which is a library. One thing which is not clear to me in this is that whether the manifest.xml file should be changed for every application.

Can you please let me know if any other ways are possible? I know this is a security issue but if the application doesnt mind I need to take the screen shots.

Thanks.


if you don't need the status bar (or keyboard) you can do this in your activity:

View root = findViewById(android.R.id.content);
root.setDrawingCacheEnabled(true);
Bitmap bm = Bitmap.createBitmap(root.getDrawingCache());
root.setDrawingCacheEnabled(false);

Completely untested but it should work.


After seeing your comment about taking screenshots of other applications I do not believe that what you want is possible without rooting the phone.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜