今天想调试多个task中栈的情况,在测试程序中调用另一个程序的activity,
代码片段如下:
btnStartX=(Button)findViewById(R.id.btnStartX); btnStartX.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent myIntent = new Intent(); myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); myIntent.setClassName("com.linc.TestBackStackXYZ", "com.linc.TestBackStackXYZ.ActivityX"); startActivity(myIntent); } });
结果报错:
java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.linc.TestBackStackXYZ/.ActivityX } from ProcessRecord{406f5a18 370:com.linc.TestBackStack/10042} (pid=370, uid=10042) requires null
<activity android:name="ActivityX" android:label="ActivityX"> <intent-filter> <action android:name="android.intent.action.MAIN" /> </intent-filter> </activity>