Android save file path summary

1. Storage in Android can be divided into two categories: private storage and shared storage.

  • Private Storage : Each application has its own private directory (/data/data/packageName) in the internal storage. Other applications cannot see it, and each other cannot access this directory.
  • Shared Storage : Except for private storage, everything else is considered shared storage, such as media collection and SD card external application storage directory

2. Android system save file path

1. Internal storage path

Context.getFilesDir().getPath()

/data/user/0/com.test.myapplication/files
Context.getCacheDir().getPath()

/data/user/0/com.test.myapplication/cache
Context.getCodeCacheDir().getPath()

/data/user/0/com.topqizhi.qwatch/code_cache
Context.getDataDir().getPath()

/data/user/0/com.topqizhi.qwatch

2. External storage path

Context.getExternalCacheDir().getPath()

/storage/emulated/0/Android/data/com.test.myapplication/cache
Context.getObbDir().getPath()

/storage/emulated/0/Android/obb/com.test.myapplication
Environment.getExternalStorageDirectory().getPath()

/storage/emulated/0

Guess you like

Origin blog.csdn.net/Billy_Zuo/article/details/132852905