今天想调试多个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
开始以为是permission的原因呢,查找了一遍permission没有结果。后来是因为ActivityX在manifast文件定义中没有加入action,如下定义就好了:
- <activity android:name="ActivityX" android:label="ActivityX">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- </intent-filter>
- </activity>
Android:调用其他程序中的activity和Permission Denial: starting Intent 错误解决办法,布布扣,bubuko.com
Android:调用其他程序中的activity和Permission Denial: starting Intent 错误解决办法