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());
Request () is a simple static method of the MyDialog class:
static public void Prompt(Activity activity) { MyDialog myDialog = new MyDialog(); myDialog.showAlert("Alert", activity); }
The problem is that I bought two errors for what I am trying to do:
- The runOnUiThread (Runnable) method in type Activity is not applicable for arguments (void)
- The Prompt (Activity) method in type MyDialog is not applicable for arguments (new Runnable () {})
All I wanted was to "do it right" by delaying the creation of the dialog box until the user interface flow, but it seems that I am missing something fundamental.
What am I missing and how can I accomplish the seemingly simple task that I am trying to achieve?
source share