So i have a count button which disabled for two hours lets say 1am to 3am. I want to reset counter when the button is enabled again.
For example.
I have a counter which has 40 counts right now .the time is 1am and counter button is disabled for two hours it will enable on 3am. So i want when counter button is enabled on 3am counts should be zero after 3 am.
I hope you get what i am trying to say. I will try to explain once more. Right now time is 12am and the counts are 40. Now time is 1am and now count button is disabled for two hours .at 3am count button is enabled so at this point of time i want my counts to be zero.
Here is my java code for counter.
@Override
public void onClick(View v) {
int hours = new Time(System.currentTimeMillis ()).getHours();
if(hours == 23 || hours == 24||hours == 01){
//Disable
}else{
//Enable
count10counter++;
}
count10.saveTotalInPrefcount10 ( getApplicationContext (),count10counter );
tvcount10.setText ( Integer.toString ( count10counter ) );
Toast.makeText ( getApplicationContext (),"you clicked 10",Toast.LENGTH_SHORT ).show ();
}
} ); ```
I also have reset button but that reset button can be clicked by every user and i dont want.only i or admin should be able to click reset button.if someone has any suggestions on this please suggest me.
``` RESET.setOnClickListener ( new View.OnClickListener ( ) {
@Override
public void onClick(View arg0) {
count10counter=0;
tvcount10.setText ( String.valueOf ( count10counter ) );
}
} );```