How to implement pause()
and resume()
in a way that pause()
stops code execution (prevents proceedFurther()
from execution) until resume()
is called by clicking the button
?
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
resume();
}
});
pause();
proceedFurther();
As I understand OnClickListener creates a separeate thread and main thread must be stopped somehow with concurrency-stuff I'm not aware of.