To prevent a button from being clicked by the user or by testing mm, write a method to prevent a continuous click of the buttons. The concrete instance code looks like this:
public class Baseactivity extends activity {protected Boolean Isdestroy;
The flag to prevent repeated clicks is set to False when clicking on other activity, set to True private Boolean clickable=true in the Onresume event;
@Override protected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate);
Isdestroy=false;
Requestwindowfeature (Window.feature_no_title);
Setrequestedorientation (activityinfo.screen_orientation_portrait);
} @Override protected void OnDestroy () {Super.ondestroy ();
Isdestroy=true;
} @Override protected void Onresume () {super.onresume ();
Each time you return to the interface, the click flag is set to clickable clickable=true;
/** * can currently click * @return/protected Boolean isclickable () {return clickable;
/** * Lock Click * * protected void Lockclick () {clickable=false; @Override public void Startactivityforresult (Intent Intent, int requestcode, Bundle options) {if (isclickable ()) {L
Ockclick ();
Super.startactivityforresult (Intent, requestcode,options); }
}
}
Through a simple piece of code to introduce you to the Android button repeat click Problem, I hope you like.