Internal Storage:
To find locations on internal storage for your app, use getFilesDir()
, called on any Context
(such as your Activity
, to get a File
object.
There's getDir
,
http://developer.android.com/reference/android/content/Context.html#getDir(java.lang.String,int)
Please have a look at:
http://developer.android.com/guide/topics/data/data-storage.html#filesInternal
For your purpose, instead of what you did with the path of sdCard, you can use
getExternalFilesDir
http://developer.android.com/reference/android/content/Context.html#getExternalFilesDir(java.lang.String)
It returns the path to files folder inside
Android/data/data/your_package/ on your SD card. It is used to store
any required files for your app (e.g. images downloaded from web or
cache files). Once the app is uninstalled, any data stored in this
folder is gone too.
Also,
Starting in KITKAT, no permissions are required to read or write to
the returned path; it's always accessible to the calling app. This
only applies to paths generated for package name of the calling
application. To access paths belonging to other packages,
WRITE_EXTERNAL_STORAGE and/or READ_EXTERNAL_STORAGE are required.
Can check more:
http://www.mysamplecode.com/2012/06/android-internal-external-storage.html
http://www.vogella.com/code/ApiDemos/src/com/example/android/apis/content/ExternalStorage.html
For API 8 and above that would work fine.
In case you want to a similar implementation for API 7 and below also,
getExternalStorageDirectory()
It returns the root path to your SD card (e.g mnt/sdcard/). If you
save data on this path and uninstall the app, that data won't be lost.