AsynTask完成后开始新活动的最佳做法是什么
我尝试在post post上启动它,如下所示:
@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);
}
但我得到了一个异常:从活动外部调用startActivity()需要标志FLAG_ACTIVITY_NEW_FLAG
由于
答案 0 :(得分:1)
Intent myIntent = new Intent(this, FlagGameRecapActivity.class);
myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(myIntent);