Intent 的隐式跳转总是崩溃的问题(已解决)
来源:互联网 发布:自我管理那个软件好 编辑:程序博客网 时间:2024/05/20 03:06
Intent有两种跳转方式,一种是显示跳转,一种是隐式跳转。
显示跳转主要是用在应用内的界面跳转,而隐式跳转一般用于跨应用跳转,如跳转到选取联系人信息或系统相册界面等。
因已经有一篇文章详尽的描述了intent的显示跳转方式,本文将着重介绍Intent的隐式跳转。
隐式跳转的核心:清单文件和当前Activity界面。
在清单文件中配置目标Activity的data、category、action的值,在当前Activiyt中依次设置intent的data、category、action值即可。
以下是代码:
清单文件:
<span style="font-size:12px;"><activity android:name=".OtherActivity" android:label="@string/str_two_label"> <intent-filter> <action android:name="com.zhi.meimei"/> <category android:name="android.intent.category.DEFAULT" /> <category android:name="com.zhi.yugong"/> <data android:scheme="zhi" android:host="www.zhi.com" android:path="/zhi" android:mimeType="image/png"/> </intent-filter> </activity></span>
当前Activity文件:
private void jump(){ Intent intent = new Intent(); intent.setAction("com.zhi.meimei"); intent.addCategory("com.zhi.yugong"); intent.setDataAndType(Uri.parse("zhi://www.zhi.com/zhi"), "image/png"); startActivity(intent); }
我在实验过程中,引起崩溃的原因不是因为单词错误,而是在清单文件中配置category时,没有添加一个默认的category。
即:<category android:name=”android.intent.category.DEFAULT”/>
0 0
- Intent 的隐式跳转总是崩溃的问题(已解决)
- 关于weblogic apache 的页面跳转问题(已解决)
- 小谈如何解决VC6.0 open崩溃的问题(已解决)
- [VC6] 小谈如何解决VC6.0 open崩溃的问题(已解决)
- 关于intent跳转的问题!
- onNewIntent intent 获取到的Intent总是重复的问题
- 关于weiphp 或者 onethink 验证码 总是错误的问题(已解决)
- DNN使用非80端口和总是跳转到http://localhost问题的解决
- DNN使用非80端口和总是跳转到http://localhost问题的解决
- minicom崩溃问题的解决
- 解决RealPlayer11崩溃的问题
- 解决Chrome 以下插件已崩溃:shockwave flash错误提示的问题
- 从Notification启动intent导致新建Activity的问题【已解决】
- [Android] 解决设置了Intent.FLAG_ACTIVITY_NO_ANIMATION 跳转activity还有动画的问题
- 解决应用程序池总是死的问题
- 解决eclipse总是building workspace的问题
- Intent的隐藏跳转
- Intent 跳转的实现
- 文件类型检测
- Object c/swift,java,c/c++在32位和64位各个平台上基本数据类型 所占有的字节数
- [LeetCode]--31. Next Permutation
- POJ2420 费马点问题求解 随机化 模拟退火
- 5 Rookie Mistakes to Avoid with Angular 2
- Intent 的隐式跳转总是崩溃的问题(已解决)
- OpenJudge noi 1253 Dungeon Master(POJ 2251)
- Hadoop HA的理解
- CTO、技术总监、首席架构师的区别
- [普及]NOIP 2003 乒乓球
- [BZOJ1967][Ahoi2005]CROSS 穿越磁场(离散化+spfa)
- Servlet
- 神奇的this
- jquery 自定义方法名