programmatically taking screenshot of current screen in android device?

点点圈 提交于 2021-02-18 19:05:14

问题


I am working on an app in which I have some edit texts and background image. I wrote something in that edit text, I want to save whole current screen as an image, so that I can send it via email. I got a solution using ASL(android screenshot library) but for this I have to start native service on my device every time when I reboot it. So is there any other solution to take screenshot of current screen?


回答1:


Try this.. find the Parent layout in you xml and do this.

  LinearLayout ll = (LinearLayout )findViewById(R.id.layout);
     ll .setDrawingCacheEnabled(true);
     Bitmap bm = v1.getDrawingCache();


来源:https://stackoverflow.com/questions/6815573/programmatically-taking-screenshot-of-current-screen-in-android-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!