Android(安卓)Intent
16lz
2022-07-30
今天在使用intent跳转到其他页面时报以下错误:
代码:Intent mIntent = new Intent();mIntent.setComponent(new ComponentName("com.app","com.app.test11.TestActivityA"));mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);startActivity(mIntent);写道 错误信息:
W/System.err(17596): java.lang.SecurityException: Permission Denial: starting Intent { cmp=com.app/com.tcl.app.test11.TestActivityA} from ProcessRecord{417f2160 17596:com.app.common.shortcut.menu/10106} (pid=17596, uid=10106) not exported from uid 1000
进行了n多测试,解决该问题的方法是:
在manifest中定义该目标Activity时加上过滤器。
代码如下:
<activity android:name=".test11.TestActivityA" > <intent-filter> <action android:name="android.intent.action.MAIN" /> </intent-filter> </activity>
更多相关文章
- android EditText设置不可写
- android 使用html5作布局文件: webview跟javascript交互
- android studio调试c/c++代码
- IM-A820L限制GSM,WCDMA上网的原理(其他泛泰机型可参考)7.13
- 锁屏界面
- Android(安卓)- Manifest 文件 详解
- android(NDK+JNI)---Eclipse+CDT+gdb调试android ndk程序
- Android(安卓)version and Linux Kernel version
- Android(安卓)闹钟管理类的使用