Android prevents multiple clicks, causing event listening to respond to other interfaces. android listening
The following is a case:
Click A to jump to page B. Click B to finish. Return to page.
1. On the page B, set the Click Event and click Finish B.
V. setOnClickListener (new OnClickListener () {@ Overridepublic void onClick (View v) {B. finish ();}});
2. If you click B multiple times in A row at this time, the system may return A after B ends. The click event is returned to interface A, which leads to repeated display on interface B.
3. To solve this problem, you can use the latency policy. After you click "B" on the page B, the system does not return to interface A immediately. Instead, it sets A latency. After you click it, after A delay of 1000 ms (custom), end B and return to interface. In this way, the click event is displayed in interface A after repeated clicks on interface B.
4. The Code is as follows:
V. setOnClickListener (new OnClickListener () {@ Overridepublic void onClick (View v) {v. setOnClickListener (null); // The Listener handler whose event needs to be ended here. postDelayed (new Runnable () {@ Overridepublic void run () {B. finish () ;}}, 500 );}});