Good day!
There was a task to create an additional stream in the Android application for working in the background. It is necessary to run an AlertDialog with the results of the task after performing a lengthy task in the stream.
Good day!
There was a task to create an additional stream in the Android application for working in the background. It is necessary to run an AlertDialog with the results of the task after performing a lengthy task in the stream.
As far as I know, the dialog can only be started from the main thread If you have a link to the activation, you can do it this way.
activity.runOnUiThread(new Runnable() { @Override public void run() { //показать диалог } }); AsyncTask<> background thread through AsyncTask<> , after the end of the background task AsyncTask allows you to use the onPostExecute() handler, in which you can easily call AlertDialog to inform the user of the result of the task.
Source: https://ru.stackoverflow.com/questions/619581/
All Articles