Reputation: 6738
In my app I have one button which works as "pause" and "Resume". Here user can click this button manually to pause and resume. And somethimes I am performing click programatically using view.performClick()
method.
The question is....is it possible to know by which click button clicked ?
Thanks
Edit:
I am using timer in my app and I want to pause and resume timer.
Upvotes: 0
Views: 181
Reputation: 467
if(button.getText().toString().trim().equalsIgnoreCase("pause")){
// puse your timer here or whatever you would like
}else{
//resume your time here or whatever you would like
}
Upvotes: 0
Reputation: 5028
Handle the click in a different method:
private void handleClick(boolean manualClick) {
//your code...
}
public void onClick(View view) {
handleClick(true);
}
and do not use view.performClick()
to call it automaically, but call handleClick(false)
Upvotes: 2
Reputation: 329
You can set the flag true/false when click manually, and use that while performing click operation.
Upvotes: 0