Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK

Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
Intent跳页面的时候报了这个错。
解决方法:
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
代码:

 Intent intent = new Intent(this, LoginActivity.class);
 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
 startActivity(intent);

解决了

你可能感兴趣的:(Android,android)