Intent:隐式意图

简介:

代码:

1
2
3
4
5
6
7
8
9
10
findViewById(R.id.button1).setOnClickListener( new  OnClickListener()
{
     @Override
     public  void  onClick(View v)
     {
         Intent intent =  new  Intent();
         intent.setAction( "org.yuchen.AAA" ); //设置intent
         startActivity(intent );
     }
});


配置xml文件:

1
2
3
4
5
6
7
8
<activity
     android:name= "com.example.ex04_layout.SecondActivity"
     android:label= "@string/title_activity_second"  >
     <intent-filter >
         <action android:name= "org.yuchen.AAA" />
         <category android:name= "android.intent.category.DEFAULT" /><!-- 隐式意图:category这一句必须添加 -->
     </intent-filter>
</activity>




本文转自 glblong 51CTO博客,原文链接:http://blog.51cto.com/glblong/1198602,如需转载请自行联系原作者
目录
相关文章
|
8月前
|
Java API Android开发
Android 中Activity和Intent的详解
Android 中Activity和Intent的详解
76 0
|
10月前
|
XML 存储 前端开发
Android:Intent 和 Intent 过滤器
在前 4 篇文章中,我们介绍了 Android 四大组件的基础知识,四大组件是构成我们 App 的基础,也是 Android 系统设计的最佳体现。各个组件之间完全是解耦的,如果想访问其他组件或者启动其他组件可以使用 Intent 来操作。在四种组件类型中,有三种(Activity、Service 和 Broadcast)均可以通过异步消息 Intent 进行启动。Intent 会在运行时对各个组件进行互相绑定。所以我们可以把 Intent 当作是各个组件之间的信使(无论该组件是自己 App 的还是其他 App)。
54 0
Android:Intent 和 Intent 过滤器
intent
intent intent 是一种构造,应用程序可以通过它发出请求,这就像是发出求助信号。intent 可能像下面这样: "Wanted: An application to help me look up a contact" 或 "Wanted: An application to help me display this image" 或 "Wanted: An application to perform this geographic-based search" 应用程序可以按照相似或互补的方式进行注册,表明它们有能力或有兴趣执行各种请求或 intent。
|
Java Android开发 数据格式
|
定位技术 Android开发
|
Java Android开发 计算机视觉
Intent常用使用汇总
方法一:调用默认的短信程序Intent intent = new Intent(Intent.ACTION_VIEW);intent.setType("vnd.android-dir/mms-sms");intent.
1238 0

热门文章

最新文章