Android Storing Files in Internal & External Storage

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

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


Got any Android Question?