【Android】Intent的显式隐式用法
2016-04-14 08:54
531 查看
显式Intent
Intent intent = new Intent(FirstActivity.this, SecondActivity.class);
startActivity(intent);
Manifest文件:
<activity
android:name="com.activity.activitytest.SecondActivity">//显式Intent不需要指定intent-filter
</activity>
隐式Intent
Intent intent = new Intent(“com.activity.activitytest.ACTION_START”);
startActivity(intent);
Manifest文件:
<activity
android:name="com.activity.activitytest.SecondActivity">
<intent-filter >
<action android:name="com.activity.activitytest.ACTION_START"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="com.activity.activitytest.MyCategory"/>
</intent-filter>//隐式Intent需指定intent-filter
</activity>
也可以使用Intent显式其他界面
Intent i = new Intent(Intent.ACTION_VIEW);
Intent i = new Intent(Intent.ACTION_DIAL);
Intent intent = new Intent(FirstActivity.this, SecondActivity.class);
startActivity(intent);
Manifest文件:
<activity
android:name="com.activity.activitytest.SecondActivity">//显式Intent不需要指定intent-filter
</activity>
隐式Intent
Intent intent = new Intent(“com.activity.activitytest.ACTION_START”);
startActivity(intent);
Manifest文件:
<activity
android:name="com.activity.activitytest.SecondActivity">
<intent-filter >
<action android:name="com.activity.activitytest.ACTION_START"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="com.activity.activitytest.MyCategory"/>
</intent-filter>//隐式Intent需指定intent-filter
</activity>
也可以使用Intent显式其他界面
Intent i = new Intent(Intent.ACTION_VIEW);
Intent i = new Intent(Intent.ACTION_DIAL);
相关文章推荐
- Android数据缓存的实现
- MVP在Android平台上的应用
- Android自定义控件实现简单写字板功能
- 4000 Android中Activity相关知识-1
- AndroidStudio 快捷键使用总结
- Android 基本控件的使用二(注册许可协议)(CheckBox)
- Android所需的Java基础知识体系图
- [Android] 字体使用dp单位避免设置系统字体大小对排版的影响
- Android 基本控件的使用一(用户的登录界面)
- Android中自定义样式与View的构造函数中的第三个参数defStyle的意义
- Android之广播机制—本地广播
- Android之广播机制—有序广播
- Android之广播机制—自定义广播
- Android之广播机制—动态注册
- 安卓ExpandableListView长按监听判断点击的item属于哪个group(群组)和child(子项)
- Android 图片如何高效加载与缓存 (5) —— RecyclerView与自定义线程池结合 优化加载
- Android View 焦点问题(EditText clearFocus)
- android学习——Handler引起的内存泄露及解决方法
- Android SDK Manager无法更新的解决方案
- Android反编译和二次打包实战