storing android application data on SD Card

前端 未结 6 2028
-上瘾入骨i
-上瘾入骨i 2020-12-07 17:19

Is there a way to store android application data on the SD card instead of in the internal memory? I know how to transfer the application sqlite database from the internal m

6条回答
  •  生来不讨喜
    2020-12-07 17:46

    Here is another neat little trick. The Application has a number of methods which are called to acquire paths. In particular the application has the method getDatabasePath with is used by SQLiteOpenHelper to construct the path. A custom application class can override these methods to provide different paths including paths in the getExternalStorageDirectory.

    The external storage is either application specific or public. There are methods, replacing the getExternalStorageDirectory mechanism, getExternalFilesDir() and getExternalStoragePublicDirectory() respectively.

提交回复
热议问题