Intent组件
2015-07-15 19:37
501 查看
Intent属性
component:Intent的component属性需要ComponentName对象,component对象包含如下几个构造器:
Action、Category属性与intent-filter配置
Action、category属性都是一个普通的字符串,Action代表Intent所要完成的一个“抽象”动作,Category用于为Action增加额外的附加类别信息。通长Action和Category属性结合使用。
显示Intent
隐式Intent
component:Intent的component属性需要ComponentName对象,component对象包含如下几个构造器:
Action、Category属性与intent-filter配置
Action、category属性都是一个普通的字符串,Action代表Intent所要完成的一个“抽象”动作,Category用于为Action增加额外的附加类别信息。通长Action和Category属性结合使用。
显示Intent
//显示Intent ComponentName cmp = new ComponentName(MainActivity.this, PlayList.class); Intent intent = new Intent(); intent.setComponent(cmp); startActivity(intent); //可简写为 Intent intent = new Intent(MainActivity.this, PlayList.class);
隐式Intent
//代码 Intent intent = new Intent(); intent.setAction("TO_SERVICE_ACTION"); intent.putExtra("playerState", PROGRESS_CHANGE); intent.putExtra("progress", progress); startService(intent); //配置文件AndroidManifest.xml <service android:name="com.music.service.MusicService" android:permission="oem.permission.SENDMAIL"> <intent-filter > <action android:name="TO_SERVICE_ACTION"/> </intent-filter> </service>
相关文章推荐
- 使用C++实现JNI接口需要注意的事项
- Android IPC进程间通讯机制
- Android Manifest 用法
- [转载]Activity中ConfigChanges属性的用法
- Android之获取手机上的图片和视频缩略图thumbnails
- Android之使用Http协议实现文件上传功能
- Android学习笔记(二九):嵌入浏览器
- android string.xml文件中的整型和string型代替
- i-jetty环境搭配与编译
- android之定时器AlarmManager
- android wifi 无线调试
- Android Native 绘图方法
- Android java 与 javascript互访(相互调用)的方法例子
- android 代码实现控件之间的间距
- android FragmentPagerAdapter的“标准”配置
- Android"解决"onTouch和onClick的冲突问题
- android:installLocation简析
- android searchView的关闭事件
- SourceProvider.getJniDirectories