简体   繁体   中英

File has to store in current open folder of my file manager app

I have a File Manager app where I have integrated scan app. If I opened any folder or any path from the file manager and in that current open folder if I click on scan the file has to create in that current open folder.

On different Android platforms, you can have problems with writing to some folders. I would scan to system picture directory because you always have access to it.

File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
File file = new File(path, "MyScanPicture.jpg");

Note, DIRECTORY_DCIM is the traditional location for pictures and videos when mounting the device as a camera. DIRECTORY_PICTURES is standard directory in which to place pictures that are available to the user.

On the other hand, its bad practice asking user unnecessary question (open file manager in your case).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM