xml - Android: Using self-defined metadata -
i want make android application shows questions on go on basis of user selection. won't use server, , questions have bundled app. adding whole questions not great design, either sqlite database can used, or xml metadata can used. sqlite bundling heard makes app large in size. so? , explain how refer xml file self-defined metadata, create questions on fly. best way this?
the sqlite db on phone already, i've used few times no big jump in .apk size.
if looking easy-to-use stored hashmap, try sharedpreferences! though wouldn't use heavy solution, implementation guarantees acid , straightforward. can make several different hashmaps , name them different things sharedpreferences http://developer.android.com/reference/android/content/sharedpreferences.html
i declare:
private sharedpreferences anchorhash;
in oncreate:
anchorhash = getsharedpreferences(getstring(r.string.anchor_hash), mode_private);
inonpause:
sharedpreferences.editor editor = anchorhash.edit(); editor.clear(); for( string s: anchors.keyset()){ //it's hashmap want write here, can editor.putstring(s, anchors.get(s)); } editor.apply(); //or commit() if need know success ( it'll happen )
Comments
Post a Comment