android开发如何在页面之间传参
第一个页面跳转 传递值
Button bn1=(Button)findViewById(R.id.btn_Login); //跳转
bn1.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
Intent intent=new Intent(tiaoz.this,nexts.class);
//传值
EditText txt_username=(EditText)findViewById(R.id.edit_username);
EditText txt_password=(EditText)findViewById(R.id.edit_password);
Bundle bundle = new Bundle();
bundle.putString("key_username", txt_username.getText().toString());
bundle.putString("key_password", txt_password.getText().toString());
intent.putExtras(bundle);
startActivity(intent);
finish();
}
});
第二个页面接收值
Bundle bunde = this.getIntent().getExtras();
String strs="用户名:"+bunde.getString("key_username").toString()+"密码:"+bunde.getString("key_password").toString();
//改变文本框的文本内容
show.setText(strs);
最新文章
- HDU 5102 The K-th Distance(模拟)
- WPF学习之路(一) 初识WPF
- express-11 表单处理(2)
- css实现固定高度及未知高度文字垂直居中的完美解决方案
- 内存泄露:*.hprof
- gitweb安装
- Toast的使用具体解释
- jQuery中$.get()、$.post()和$.ajax()
- 根据list<;Object>;中的某个字段排序
- 六度分离(floyd算法+dijskra+SPFA)
- css2.1实现圆角边框
- 谈谈php依赖注入和控制反转
- 实现AutoMapper(1.0版本)
- JavaScript中Float类型保留两位小数
- WPF Blend Grid 布局
- React 使用 PropTypes 进行类型检查
- UVALive 6906 Cluster Analysis 并查集
- 关于c++显示调用析构函数的陷阱
- 在Windows下远程连接CentOS6
- PowerDesigner 的常用方法
热门文章
- GBK与Unicode的转换
- Android学习使用基本界面组件(下拉框,单选框,复选框,数字转轮,滚动条)
- CentOS6.5_x64安装MySQL-5.6.17,在已经启动MySQL服务的情况下,出现密码报错ERROR 2002 (HY000)
- opencv:图像直方图均衡化
- 【visio】 图片
- Laravel Vuejs 实战:开发知乎 (2)用户注册
- 【C语言】赋值运算中的类型转换
- git 工具常见命令
- C语言:将字符串中的字符逆序输出,但不改变字符串中的内容。-在main函数中将多次调用fun函数,每调用一次,输出链表尾部结点中的数据,并释放该结点,使链表缩短。
- 「CF911F」Tree Destruction