Reputation: 6884
What's the best practice to start a new activity when AsynTask is finished,
I try to launch it on post execute like this :
@Override
protected void onPostExecute(Void result) {
Log.d(TAG, "end flag game print recap");
//launch activity flag game recap
Intent myIntent = new Intent(context, FlagGameRecapActivity.class);
context.startActivity(myIntent);
super.onPostExecute(result);
}
But i got an Exception : Calling an startActivity() from outside an activity require the flag FLAG_ACTIVITY_NEW_FLAG
Thanks
Upvotes: 0
Views: 869
Reputation: 30794
Intent myIntent = new Intent(this, FlagGameRecapActivity.class);
myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(myIntent);
Upvotes: 1