天天看點

FLAG_ACTIVITY_NEW_TASK

轉載注明出處:http://blog.csdn.net/moushao/article/details/64906321

Android系統,有時候可能需要跳轉到系統設定界面,則會報出:

Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?

提示我們添加 FLAG_ACTIVITY_NEW_TASK

解決方法:添加下段紅色代碼

Intent intent = new Intent(Settings.ACTION_DATE_SETTINGS);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
           

繼續閱讀