I am trying to create a dialog from a non-UI thread, in onUtteranceCompleted():
runOnUiThread(
new Thread(new Runnable() {
public void run() { MyDialog.Prompt(this); }
}).start());
Prompt() is a simple static method of the class MyDialog:
static public void Prompt(Activity activity) {
MyDialog myDialog = new MyDialog();
myDialog.showAlert("Alert", activity);
}
The problem is that I cam getting two errors for what I am trying to do:
- The method runOnUiThread(Runnable) in the type Activity is not applicable for the arguments (void)
- The method Prompt(Activity) in the type MyDialog is not applicable for the arguments (new Runnable(){})
All I wanted is "do it right" by deferring dialog creation to a UI thread, but it appears that I am missing something fundamental.
What am I missing and how do I accomplish the seemingly simple task that I am trying to achieve?