Mindon.IDEA

Air off, Mind on ~ / Javascript+Golang, Sci, Health… /

Android App Data & Folders

Context context = getApplicationContext();

SQLite Databases

context.getDatabasePath("myDbName")

Cache

System will clean it auto if low memory

context.getCacheDir()

Lib

context.getFilesDir()

Apk & resources path

context.getPackageCodePath() context.getPackageResourcePath

Shared Preferences

getSharedPreferences() getPreferences()

Internal Storage

removed when uninstall the app MODE_PRIVATE | MODE_APPEND | MODE_WORLD_READABLE | MODE_WORLD_WRITEABLE

FileOutputStream fos = openFileOutput(flName, Context.MODE_PRIVATE);    
fos.write(content.getBytes());    
fos.close();  

Internal Files Operations

Internal files path

.getDir() .getFilesDir() .deleteFile() .fileList

External Storage

Checking media availability

.getExternalStorageState()

Environment.MEDIA_MOUNTED | MEDIA_MOUNTED_READ_ONLY

Environment.getExternalStorageDirectory()


Environment.getExternalStoragePublicDirectory(
        Environment.DIRECTORY_PICTURES
    )


<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

.getExternalStoragePublicDirectory()

Environment.DIRECTORY_MUSIC | DIRECTORY_PICTURES | DIRECTORY_RINGTONES

.getExternalCacheDir()

Comments