I am talking about one thread. For example I have an Activity ui and following methods in it:
/* TOP LEVEL OF EXECUTION LOOPER NOW WORKING */
class MyActivity extends Activity {
void onCreate(Bundle instance) {
super.onCreate(instance);
setContentView(R.layout.activity_main);
doComplicatedStuff();
}
void doComplicatedStuff() {
// Doing stuf
}
void onClick() {
// Process event
}
void anyOtherMethod() {
/* NOT TOP LEVEL OF EXEUCTION, LOOPER NOW CAN'T WORK */
}
}
/* TOP LEVEL OF EXECUTION, LOOPER NOW WORKING */
So my question is, can doComplicatedStuff() be interrupted by execution of onClick() handler (when of course, we had a clicked button) ?
Now I think than onClick() handler can't interrupt doComplicatedStuff() execution until doComplicatedStuff() ends its work. Because on top level of code execution we have an Looper, that accepts next message event and dispatch it to Handler (handler then call onClick() method). In other words, Looper do your work only when there is no any executing method in this thread.