If you're using API Level 8 or greater, use getExternalFilesDir() to open a File that represents the external storage directory where you should save your files. This method takes a type parameter that specifies the type of subdirectory you want, such as DIRECTORY_MUSIC and DIRECTORY_RINGTONES (pass null to receive the root of your application's file directory). This method will create the appropriate directory if necessary. By specifying the type of directory, you ensure that the Android's media scanner will properly categorize your files in the system (for example, ringtones are identified as ringtones and not music). If the user uninstalls your application, this directory and all its contents will be deleted.
If you're using API Level 7 or lower, use getExternalStorageDirectory(), to open a File representing the root of the external storage. You should then write your data in the following directory:
/Android/data/<package_name>/files/
The <package_name> is your Java-style package name, such as "com.example.android.app". If the user's device is running API Level 8 or greater andthey uninstall your application, this directory and all its contents will be deleted.
If you're using API Level 8 or greater, use
getExternalFilesDir()
to open aFile
that represents the external storage directory where you should save your files. This method takes atype
parameter that specifies the type of subdirectory you want, such asDIRECTORY_MUSIC
andDIRECTORY_RINGTONES
(passnull
to receive the root of your application's file directory). This method will create the appropriate directory if necessary. By specifying the type of directory, you ensure that the Android's media scanner will properly categorize your files in the system (for example, ringtones are identified as ringtones and not music). If the user uninstalls your application, this directory and all its contents will be deleted.If you're using API Level 7 or lower, use
getExternalStorageDirectory()
, to open aFile
representing the root of the external storage. You should then write your data in the following directory:The
<package_name>
is your Java-style package name, such as "com.example.android.app
". If the user's device is running API Level 8 or greater and they uninstall your application, this directory and all its contents will be deleted.