android - App Inventor: A way to track 2 scores across multiple screens -


i looking way send 2 scores (called coins , gems) treasure game across several screens. class.

i have tried tiny db not wipe after each game played , have not found fool proof way make clear if closes game.

i have tried using close screen start value 1 value , need have both send next screen.

i have tried creating list gems , coins value start value can not continue add scores on next screen , gives me errors.

i include screenshots , code @ point jumbled together. have tried make sure each screen closes , sends value has been not successful appreciated. can post whatever helpful!

what sounds need umbrella type class.

make separate class, name, example, myapp.

then make coin , gem values in myapp class. use these values maintain across multiple activities. when done on screen, add values accumulated on screen myapp totals, once new "activity or fragment" screen. initialize screen values myapp class.

if want totals cleared upon each start up, make boolean value variable in myapp class well. "firstgamebool", if initial value true, set variables initial states, set false after first run keep program erasing values after restarting play, not entire app.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -