How to save my current game into cache?
I'm currently deve开发者_运维百科loping an android game using SurfaceView and i want to save my GameField class/object to the cache.
Can you please help me.
Thanks.
this should explain it:
http://mobile.tutsplus.com/tutorials/android/android-application-preferences/
Do you mean that you want to save the game state to the device so it can be restored when the application restarts? If so, consider using SharedPreferences
as outlined here:
http://developer.android.com/reference/android/content/SharedPreferences.html
If SharedPreferences won't work, here is an article about all the basic persisted storage options available: http://developer.android.com/guide/topics/data/data-storage.html
精彩评论