传递数据包
2015-12-14 20:15
274 查看
设置参数
Intent i = new Intent(MainActivity.this,TheAty.class);
Bundle bundle = new Bundle();
bundle.putString("name", "王城");
bundle.putInt("age", 26);
i.putExtras(bundle);//i.putExtra("data", bundle);
startActivity(i);
接收数据包
TextView tv = (TextView) findViewById(R.id.otherActy);
Intent i = getIntent();
Bundle data = i.getExtras();//Bundle data = i.getBundleExtra("data");
tv.setText(String.format("%s的年龄是%d",data.getString("name"),data.getInt("age")));
Intent i = new Intent(MainActivity.this,TheAty.class);
Bundle bundle = new Bundle();
bundle.putString("name", "王城");
bundle.putInt("age", 26);
i.putExtras(bundle);//i.putExtra("data", bundle);
startActivity(i);
接收数据包
TextView tv = (TextView) findViewById(R.id.otherActy);
Intent i = getIntent();
Bundle data = i.getExtras();//Bundle data = i.getBundleExtra("data");
tv.setText(String.format("%s的年龄是%d",data.getString("name"),data.getInt("age")));
相关文章推荐
- 一些简单的网络流模型
- json处理复杂对象jsonConfig
- ThinkPHP--多表查询之join和table的用法
- HDU 1177 "Accepted today?" 水题
- 推送 -- 原理
- 将github上开源项目导入AndroidStudio中
- PAT 乙级 1007. 素数对猜想 (20)
- poj3685
- 字符集及其比较方式(Character Sets and Collations)
- Autofac全面解析系列(版本:3.5) – [使用篇(推荐篇):3.依赖注入]
- 怪怪的函数strtok
- 快速枚举与NSEnumerator枚举遍历数组
- The JSR-133 Cookbook for Compiler Writers(an unofficial guide to implementing the new JMM)
- 《利用python进行数据分析》读书笔记--第七章 数据规整化:清理、转换、合并、重塑(三)
- Resource entry is already defined
- 在Code::Blocks中添加第三方库
- SSH原理与运用(二):远程操作与端口转发
- 【OJ8756】砝码称重V2,可达性多重背包
- poj 2299 Ultra-QuickSort 【线段树求和(点更新)】
- 软件测试中英文术语对照表