Java Android SharedPreferences issues -
i'm making game of tetris on android project school , right im using shared preferences in order save current state of game can resumed on later time , i've come realize when store on 100 or preferences sharedprefernces object starts working in strange way , can save when try call editor clear (e.clear + e.commit) wont remove preferences.
i appreciate regarding issue
thanks
sharedpreferences
, lightweight mechanism how persist data.
but think game it's not win @ all. sharedpreferences
used persisting non-structured data example if have application requires login , when user logged in can save state sharedpreferences
, in next activities
check whether user logged in or not. in game have (i guess sure) structured data-structures (for instance players , properties (values) reached score, loses, wins etc.).
so suggest think mechanism data persisting. try think possibility use classic object serializing or , usage of sqlitedatabase
provide more complex solution how persist structured data.
a main advantage can persist (serialize) whole objects , deserialize them (and not persist them specific "chunks" in sharedpreferences). regarding sqlite
, provides same solution classic serializing objects represented tables in database.
Comments
Post a Comment