简体   繁体   中英

getExternalStorageDirectory() is deprecated

Suppose I have a Notepad-like app, where you can create and save text documents.

I want my users to be able to access those files (so that they can copy them to a computer, for example).

Before API 29, getExternalStorageDirectory() was a good choice - the directory was created in the root of sdcard and easily accessible. However, since API 29 it is deprecated. So now I have to use getExternalFilesDir(null) directory.

The problem is that that directory's path is something like Android/data/your_package_name/files , which is very inconvenient for the users. Many of them can't find it. So, which method should I use?

使用 getExternalFilesDir()、getExternalCacheDir() 或 getExternalMediaDir()(上下文方法)而不是 Environment.getExternalStorageDirectory()。

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