Path to screenshots in Android

空扰寡人 提交于 2019-12-21 03:27:32

问题


Is there a way to find out the path used by android to save screenshots?

Can I get the path from a code?


回答1:


Android's API has no fixed path for screenshots but

File pix = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
File screenshots = new File(pix, "Screenshots");

might work. That's what ICS uses as path.




回答2:


The "Screenshots" value is part of the private API.

Here is link to the source code where the value is set. Since the class is loaded in our application context there is no option to access the field. I'd hardcode it as @zapi suggested.



来源:https://stackoverflow.com/questions/9667297/path-to-screenshots-in-android

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