Chinaunix首页 | 论坛 | 博客

OS

  • 博客访问: 2224592
  • 博文数量: 691
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 2660
  • 用 户 组: 普通用户
  • 注册时间: 2014-04-05 12:49
个人简介

不浮躁

文章分类

全部博文(691)

文章存档

2019年(1)

2017年(12)

2016年(99)

2015年(207)

2014年(372)

分类: Android平台

2015-11-27 11:03:38

原文地址:Intent数据传递 作者:luozhiyong131

Intent传递数据的时实际上一共分为以下六种数据:操作(Action)、数据(Data)、数据类型(Type)、操作类别(Category)、附加信息(Extras)、组件(Component)、标志(Flags) 

点击(此处)折叠或打开

  1. public class MyIntentCaseDemo extends Activity {
  2.     private Button mybut = null ;            // 按钮组件
  3.     @Override
  4.     public void onCreate(Bundle savedInstanceState) {
  5.         super.onCreate(savedInstanceState);
  6.         super.setContentView(R.layout.main);        // 默认布局管理器
  7.         this.mybut = (Button) super.findViewById(R.id.mybut) ;    // 取得组件
  8.         this.mybut.setOnClickListener(new OnClickListenerImpl());// 定义单击事件
  9.     }
  10.     private class OnClickListenerImpl implements OnClickListener {
  11.         @Override
  12.         public void onClick(View view) {
  13.             Uri uri = Uri.parse("") ;    // 指定数据
  14.             Intent it = new Intent() ;    // 实例化Intent
  15.             it.setAction(Intent.ACTION_VIEW);    // 指定Action
  16.             it.setData(uri) ;                // 设置数据
  17.             MyIntentCaseDemo.this.startActivity(it); // 启动Activity
  18.         }
  19.     }
  20. }

030902_Intent深入.ppt
阅读(1048) | 评论(0) | 转发(0) |
0

上一篇:SharedPreferences存储数据

下一篇:Intent

给主人留下些什么吧!~~