Android : Move activity to front in AsyncTask

on Wednesday, July 30, 2014


In an activity, I have created a AsyncTask after hiding the activity:



this.moveTaskToBack(true);
(new MyTask(this)).execute();


To show a dialog in the task (in onPostExcecute), I want to bring the activity to front:



alertDialog.show();

Intent intent = new Intent(mainActivity, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mainActivity.getBaseContext().startActivity(intent);


But the main activity is shown on top of the dialog (the activity has also a dialog style Theme.Dialog). How should I fix this?


0 comments:

Post a Comment