android - Sum Of Total Time Taken Of Timer -


i making game.

lets has 2 levels. have timer in both works properly. code timer:

public timer t; public int timecounter = 0; t = new timer(); t.scheduleatfixedrate(new timertask() {     @override     public void run() {         // todo auto-generated method stub         runonuithread(new runnable() {             public void run() {                 textview t = (textview)findviewbyid(r.id.txtcount);                 t.settext(string.valueof(timecounter));                 timecounter++;             }         });     } }, 1000, 1000); 

now in 3rd activity want total time (adding first activity's , second activity's time taken) shown.

also, want save time user took high score. , when user takes less time highest score, previous deleted , new saved

i appreciate help.thanks

make timecounter static

public static int timecounter = 0; 

now can increment in both of activities (in second activity retain values first activity)

activityone.timecounter++; 

wherever want value can easily.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -