I have created an android application and i would like to pause the running code and wait for a button press.
For example lets say i have 3 buttons, Button1 Button2 Button3.
I would like to do :
int a=0;
// do something
.. wait for button press..
if(button1 is pressed) a=1;
else if(button2 is pressed) a=2;
else if(button3 is pressed) a=3;
// continue
This is not how Android application development works, or application development on most modern UI frameworks (where by “modern” I mean “written in the last 25 years”). As with most other platforms and UI frameworks, Android’s widget framework is event-driven. Please modify your algorithm to be able to be handled via the
onClick()methods of your various buttons.