android.app.ContextImpl.startActivity(ContextImpl.java:617)

 android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
         at android.app.ContextImpl.startActivity(ContextImpl.java:617)

貌似在startActivity之前要加个标记:
 intent.addFlag(Intent.FLAG_ACTIVITY_NEW_TASK),无论是在activity类中,还是在其它组件类中都需要加这句话,
异常信息中已经说明了,需要FLAG_ACTIVITY_NEW_TASK intent.addFlag(Intent.FLAG_ACTIVITY_NEW_TASK)

你可能感兴趣的:(工作中遇到的问题)