java - android - reset progress bar on back pressed button -


since android 5.0 api 22 have problem on app.

i have activity called "time progress" (its not main activity). on activity have chronometer circular progress bar, time goes 15 0 , progress bar filling up.

when click on button go main menu , go again "time progress" progress bar not empty (has value, 15 or 3 or 8, random values) , want progress bar empty.

i tried onstop(); flag_activity_no_history, flag_activity_new_task, flag_activity_clear_top, set progressbar 0 nothing works.

here code

int j = 0; public void timetest() {     countdowntimer countdown = new countdowntimer(15000, 1000) {     textview timetext = (textview) findviewbyid(r.id.timetext);     progressbar progresstime = (progressbar) findviewbyid(r.id.progresstime);        @override        public void ontick(long millisuntilfinished) {           timetext.settext(long.tostring(millisuntilfinished / 1000));           j = j + 1;           progresstime.setprogress(j);       }     }       @override       public void onfinish() {          playtime.settext("time's up");      }    }.start();   } @override public void onbackpressed() {     intent backmainmenu = new intent(getbasecontext(), mainactivity.class);     startactivity(backmainmenu);   } 

should start this: image1

, not this: image2

maybe applied functions in wrong way :/ .

any please ?

thanks

why don't place code in oncreate() method set progress 0 like:

progresstime.setprogress(0); 

edit:

if set progressbar 0 dont work. can create new instance of progressbar


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -