I’ve got completely no idea why application is stopping unexpectedly when encounters commented lines in the code below.
public class Foo {
private ExitText input;
public FooExitText input) {
this.input = input;
}
public void start() {
// everything is okay:
input.requestFocus();
input.setOnKeyListener(new EntryCheckListener());
input.setEnabled(false);
// PROBLEMS!:
ExecutorService exec = Executors.newSingleThreadExecutor();
exec.execute(new Runnable() {
public void run() {
synchronized (Foo.this) {
// input.setEnabled(false);
for(int i=0; i<5; ++i) {
//input.setText("test" + i);
}
// input.setEnabled(false);
}
}
});
}
}
P.S.
What does it mean? :/
“Oops! Your edit couldn’t be submitted because:
Your post does not have much context to explain the code sections; please explain your scenario more clearly.”
You are not allowed to modify the UI from thread other then the main thread. Consider using AsyncTask.
A nice tutorial can be found in the Android site.