Android 10 storage adaptation (2)

Let me talk about several specific application directories of the memory card:

 

The context.getFilesDir() method is used to get the xxx1/package name of your application/files directory

The context.getCacheDir() method is used to get the xxx1/package name of your application/cache directory

These two directories correspond to the "Clear Data" and "Clear Cache" options in Settings -> Application -> Application Details.

 

The context.getExternalFilesDir() method can get the xxx2/Android/data/your application package name/files/ directory
context.getExternalCacheDir() method can get the xxx2/Android/data/your application package name/cache/ directory

 

Among them, xxx1 and xxx2 may display different names in different mobile phones. For example, xxx1 is /data/user/0 and xxx2 is /storage/emulated/0

Then, in Android 10, the getFilesDir() method can be used to save the file path that needs to be saved, and of course getCacheDir() will also work.

 

 


 

Supongo que te gusta

Origin blog.csdn.net/yeziyfx/article/details/110128639
Recomendado
Clasificación