隐式intent
来源:互联网 发布:小米电视软件推荐 编辑:程序博客网 时间:2024/06/07 08:26
隐式intent
一action 和category
1在清单文件中配置intent-filter
<activity Android:name=".SecondActivity" > <intent-filter> <action android:name="com.example.activitytest.ACTION_START" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter></activity>2配置好启动该activity的action 在启动时调用
Intent intent = new Intent("com.example.activitytest.ACTION_START");startActivity(intent);注:action可以设置多个,,是一个activity启动的字符串 可以自定义,也可以调用系统已知的action
上例category使用的是默认的,如果使用自己声明的在intent-filter里声明
二使用data隐式启动
在清单文件里设置intent-filter
<intent-filter > <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> <data android:scheme="m" android:host="my.test" /> </intent-filter><action android:name="android.intent.action.VIEW"/> 内置 动作
<category android:name="android.intent.category.BROWSABLE"/> 这个策略能通过网页启动
1. android:scheme
用于指定数据的协议部分,如上例中的http部分。
2. android:host
用于指定数据的主机名部分,如上例中的www.baidu.com部分。
3. android:port
用于指定数据的端口部分,一般紧随在主机名之后。
4. android:path
用于指定主机名和端口之后的部分,如一段网址中跟在域名之后的内容。
5. android:mimeType
用于指定可以处理的数据类型,允许使用通配符的方式进行指定。
启动的时候 :
Intent intent = new Intent("android.intent.action.VIEW"); //uri里携带参数 user和pwd字段 intent.setData(Uri.parse("m://my.test/?user=jack&pwd=wang")); startActivity(intent);在activity端获取参数里的值
Intent intent = getIntent(); Uri data = intent.getData(); String parameter = data.getQueryParameter("user");
阅读全文
0 0
- 显示Intent,隐式Intent
- 显示Intent,隐式Intent
- 显示Intent,隐式Intent
- Intent—隐式Intent与显示Intent
- 隐式Intent
- 隐式Intent
- 隐式Intent
- 隐式Intent
- 隐式Intent
- 隐式Intent
- 隐式Intent
- 隐式Intent
- 隐式Intent
- 隐式Intent
- 隐式Intent
- 隐式Intent
- 隐式Intent
- 隐式Intent
- Cocos2d-x学习 一
- 【POJ1840】Eqs
- 欢迎使用CSDN-markdown编辑器
- 暑期集训之Bear and Three Balls
- 1064. Complete Binary Search Tree (30)
- 隐式intent
- HDU1114-基础dp&完全背包-F
- java.lang.NoClassDefFoundError: org/springframework/web/context/request/async/CallableProcessingInte
- 【POJ2752】seek the name,seek the fame
- Java学习第八天
- 关于RedisTemplate和StringRedisTemplate
- Keil综合(03)_map文件全解析
- JavaScript 常用方法总结
- 3.等待和通知(Waiting and Notification)