Android学习之 Intent几种使用方法使用
来源:互联网 发布:非理性繁荣 知乎 编辑:程序博客网 时间:2024/06/06 14:19
第一种使用ComponentName类:
Intent i = new Intent();i.setComponent(new ComponentName("包名","包名下+要跳转的activity的名字"));startActivity(i)
比如说 com.intenttest下有一个IntentTestActivity类
则
Intent i = new Intent();i.setComponent(new ComponentName("com.intenttest","com.intenttest.IntentTestActivity"));startActivity(i)
一般我们采用如下方式
Intent i = new Intent(getApplicationContext(),目标activity.class);startActivity(i);
这是一种最常见的启动方式
第二种启动
在activity的配置文件中加入
<activity android:name="Aty1"> <intent-filter> <action android:name="com.test.intents.intent.action.Aty1"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity>
android:name 值的写法是AndroirdMainfest.xml里面的应用程序包名+intent.action.+"自定义的action名字"
</pre><pre name="code" class="html">而后代码中
Intent i = new Itent("<span style="font-size: 11.8181819915771px; font-family: Arial, Helvetica, sans-serif;">com.test.intents.intent.action.Aty1</span><span style="font-size: 11.8181819915771px; font-family: Arial, Helvetica, sans-serif;">");</span>startActivity(i);
前两种都是显示的启动方式
后一种是隐示的启动方式,是由操作系统确认启动的activity
0 0
- Android学习之 Intent几种使用方法使用
- Android中Intent的几种使用方法
- android学习序列笔记之Intent使用方法
- Android学习之Intent使用
- Android学习之Intent使用
- Android学习之Intent使用
- Android Intent的几种使用用法
- Android开发之Intent使用方法
- Android学习之Intent过滤器的使用
- android学习之路-使用Intent跳转
- Android之TabHost的几种使用方法
- Android之TabHost的几种使用方法
- Android Intent的几种用法全面总结(供自我学习查阅使用)
- Android之Intent学习
- Android学习之Intent
- Android学习 - Intent使用
- android学习:通过Intent打开Activity的两种方法,Intent过滤器的使用方法
- Android之Intent的几种用法<总结>
- c#_webbrowser等待网页标题下载完成并显示在textBox里
- UVAOJ401- Palindromes
- /proc/devices awk
- nfs搭建(portmap新版下改名rpcbind)
- sed中使用变量替换以及执行外部命令
- Android学习之 Intent几种使用方法使用
- 十二星座各自的性格分析,各种最
- Android中Context
- Zend_XmlRpc 使用实例(轻松实现对外接口)
- Windows以及Linux下用OCCI访问Oracle数据库
- spring3.0事务管理配置
- UML类图几种关系的总结
- 使用 HTML5 WebSocket 构建实时 Web 应用
- android 如何让主菜单的背景显示为壁纸