Exercise: Using files in an Android application

Make a simple Android application that uses a file ...

More info http://developer.android.com/guide/topics/data/data-storage.html#filesInternal

Static files

Lee page 272-

  1. Make a static file in the folder /res/raw in you Android project.
    final InputStream is = getResources().openRawResource(R.raw.yourFileName)
  2. Make an Activity to read and display the contents of the file.
  3. Make (another) Activity to change the content of the file.

Dynamic files

  1. Make an Activity to add and display the contents of a dynamic file, Lee page 264-
    FileInputStream fis = openFileInput(yourFileName);
    FileOutputStream fos = openFileOutput(yourFileName, MODE_PRIVATE);