Storing Files in Internal & External Storage

Download android eBook

Syntax

  • FileOutputStream openFileInput (String name)
  • FileOutputStream openFileOutput (String name, int mode)
  • File(File dir, String name)
  • File(String path)
  • File getExternalStoragePublicDirectory (String type)
  • File getExternalFilesDir (String type)

Parameters

ParameterDetails
nameThe name of the file to open. NOTE: Cannot contain path separators
modeOperating mode. Use MODE_PRIVATE for default operation, and MODE_APPEND to append an existing file. Other modes include MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE, which were both deprecated in API 17.
dirDirectory of the file to create a new file in
pathPath to specify the location of the new file
typeType of files directory to retrieve. Can be null, or any of the following: DIRECTORY_MUSIC, DIRECTORY_PODCASTS, DIRECTORY_RINGTONES, DIRECTORY_ALARMS, DIRECTORY_NOTIFICATIONS, DIRECTORY_PICTURES, or DIRECTORY_MOVIES

Related Examples

Stats

1985 Contributors: 6
Saturday, February 4, 2017
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook