90 likes | 265 Vues
Read and Write Files. By the end of this lab you will be able to: Write a file in internal storage Read a file from internal storage Write a file on SD card Read a file from SD card Install an app on the Android emulator. Prerequisites. Main classes you will need to learn about:
E N D
Read and Write Files • By the end of this lab you will be able to: • Write a file in internal storage • Read a file from internal storage • Write a file on SD card • Read a file from SD card • Install an app on the Android emulator CS440
Prerequisites • Main classes you will need to learn about: • BufferedReader • BufferedWriter • OutputStreamReader • OutputStreamWriter • StringBuffer • Main methods you will need to learn: • readLine!! • Write • openFileOutput • openFileInput
The mission • Create a file in internal storage • Create all the necessary objects to write in this file • BufferedWriter • OutputStreamWriter • Write in the file • Read from file • Create all the necessary objects to read from this file • BufferedReader • OutputStreamReader CS440
The endless doubt • How do you know you have created the file? • How do you know you have written in the file? CS440
The mission impossible? • Create a file in the SD card • Create all the necessary objects to write in this file • BufferedWriter • OutputStreamWriter • Write in the file • Read from file • Create all the necessary objects to read from this file • BufferedReader • OutputStreamReader CS440
References • http://www.vogella.de/articles/AndroidFileSystem/article.html • http://www.tylerfrankenstein.com/create-android-emulator-sd-card-and-write-data-to-it • http://stackoverflow.com/questions/9351904/cannot-write-to-sdcard-in-android-emulator CS440