Your SlideShare is downloading. ×
0
2013.05.09 android-l2
2013.05.09 android-l2
2013.05.09 android-l2
2013.05.09 android-l2
2013.05.09 android-l2
2013.05.09 android-l2
2013.05.09 android-l2
2013.05.09 android-l2
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

2013.05.09 android-l2

108

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
108
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 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. 2013.05.092013.05.09ContentContent SharedPreferences APIsSharedPreferences APIs File APIsFile APIs Database APIsDatabase APIs
  • 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. 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. 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. 2013.05.092013.05.09File APIs - internalFile APIs - internal FileOutputStreamFileOutputStream openFileOutput(filename, MODE)openFileOutput(filename, MODE) .write().write() .close().close()
  • 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. 2013.05.092013.05.09Database APIsDatabase APIs SQLiteSQLite SQLiteOpenHelperSQLiteOpenHelper create and manager databasecreate and manager database .getWritableDatabase().getWritableDatabase() .rawQuery().rawQuery()

×