位置: 首页

Android 从Service或者是BroadcastReceiver往Activity跳转时出现的错误

错误提示:ERROR/AndroidRuntime(192): java.lang.RuntimeException: Unable to start receiver com.test.hmenu.HMenuReceiver: android.util.AndroidRuntimeException: Calling startActivity () from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
(总之出现这样的错误就要setflags(Intent.FLAG_ACTIVITY_NEW_TASK))
===========
我也遇到了 记录一下
解决方法 街上flag
Intent it = new Intent(context,StartActivity.class);
it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);