2013.05.092013.05.09Android apps development IIAndroid apps development II- saving data and other UI component- saving dat...
2013.05.092013.05.09ContentContent SharedPreferences APIsSharedPreferences APIs File APIsFile APIs Database APIsDatabas...
2013.05.092013.05.09Saving dataSaving data 儲存資料儲存資料 shared preferencesshared preferences(simple key-value pairs of simple...
2013.05.092013.05.09SharedPreferences APIsSharedPreferences APIs a file containing key-value pairsa file containing key-v...
2013.05.092013.05.09File APIsFile APIs read/write large amounts of dataread/write large amounts of data Java.io.*Java.io...
2013.05.092013.05.09File APIs - internalFile APIs - internal FileOutputStreamFileOutputStream openFileOutput(filename, M...
2013.05.092013.05.09File APIs - externalFile APIs - external Check state firstCheck state first .getExternalStorageState...
2013.05.092013.05.09Database APIsDatabase APIs SQLiteSQLite SQLiteOpenHelperSQLiteOpenHelper create and manager databas...
Upcoming SlideShare
Loading in …5
×

2013.05.09 android-l2

265 views

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
265
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

2013.05.09 android-l2

  1. 1. 2013.05.092013.05.09Android apps development IIAndroid apps development II- saving data and other UI component- saving data and other UI componentIntroduction ofIntroduction of
  2. 2. 2013.05.092013.05.09ContentContent SharedPreferences APIsSharedPreferences APIs File APIsFile APIs Database APIsDatabase APIs
  3. 3. 2013.05.092013.05.09Saving dataSaving data 儲存資料儲存資料 shared preferencesshared preferences(simple key-value pairs of simple data)(simple key-value pairs of simple data) saving filesaving file databases by SQLitedatabases by SQLite
  4. 4. 2013.05.092013.05.09SharedPreferences APIsSharedPreferences APIs a file containing key-value pairsa file containing key-value pairs can be private or sharedcan be private or shared using when onCreate() and onPause()using when onCreate() and onPause()
  5. 5. 2013.05.092013.05.09File APIsFile APIs read/write large amounts of dataread/write large amounts of data Java.io.*Java.io.* internal (flash memory) or external (SD card)internal (flash memory) or external (SD card) External requires permissionExternal requires permissionandroid.permission.WRITE_EXTERNAL_STORAGEandroid.permission.WRITE_EXTERNAL_STORAGE* android.permission.READ_EXTERNAL_STORAGE* android.permission.READ_EXTERNAL_STORAGE
  6. 6. 2013.05.092013.05.09File APIs - internalFile APIs - internal FileOutputStreamFileOutputStream openFileOutput(filename, MODE)openFileOutput(filename, MODE) .write().write() .close().close()
  7. 7. 2013.05.092013.05.09File APIs - externalFile APIs - external Check state firstCheck state first .getExternalStorageState().getExternalStorageState() MEDIA_MOUNTED ready to go.MEDIA_MOUNTED ready to go. .getExternalFilesDir().getExternalFilesDir()
  8. 8. 2013.05.092013.05.09Database APIsDatabase APIs SQLiteSQLite SQLiteOpenHelperSQLiteOpenHelper create and manager databasecreate and manager database .getWritableDatabase().getWritableDatabase() .rawQuery().rawQuery()

×