Bundle传值问题

                Intent it=new Intent(login.this,RegisterActivity.class);
                Bundle bundle=new Bundle();
                bundle.putString("phone",phone);
                bundle.putString("country",country);
                it.putExtras(bundle);

接收端

Intent it=getIntent();
        Bundle bundle=it.getExtras();
        phone=bundle.getString("phone");
时间: 2024-08-15 10:25:16

Bundle传值问题的相关文章

Intent 传值和 Bundle传值的区别

http://blog.csdn.net/yanzi1225627/article/details/7802819 举个例子  我现在要从A界面   跳转到B界面或者C界面   这样的话 我就需要写2个Intent  如果你还要涉及的传值的话 你的Intent就要写两遍添加值的方法 那么 如果我用1个Bundle  直接把值先存里边 然后再存到Intent中 不就更简洁吗? 另外一个例子  如果我现在有  Activity A ,B ,C:现在我要把值通过A经过B传给C你怎么传 如果用Inten

在Activity之间使用Intent传值和Bundle传值的区别和方式

两者本质上没有任何区别.Bundle只是一个信息的载体 将内部的内容以键值对组织 Intent负责Activity之间的交互 自己是带有一个Bundle的Intent.putExtras(Bundle bundle)直接将Intent的内部Bundle设置为参数里的bundleIntent.getExtras()直接可以获取Intent带有的Bundle intent.putExtra(key, value)和Bundle bundle = intent.getExtras();bundle.p

android学习:intent和Bundle传值上的区别

https://blog.csdn.net/u014657752/article/details/47301569 结论: Bundle在存取数据是比较灵活的,而Intent在存取数据的种类很少且没有指定数据类型: 想对数据进行比较灵活的操作如批量操作的话就用bundle: Bundle是可以对对象进行操作的,而Intent不可以.Bundle相对于Intent比较偏下层,比Intent接口更多,更灵活,但Bundle仍需要借助Intent才能在Activity之间传递. 概括一下,Intent

Bundle、Intent、SharedPreferences

Intent与Bundle的共同点:都继承Parcelable Intent传值与Bundle传值的区别 eg:我现在要从A界面   跳转到B界面或者C界面   这样的话 我就需要写2个Intent  如果你还要涉及的传值的话 你的Intent就要写两遍添加值的方法 那么 如果我用1个Bundle  直接把值先存里边 然后再存到Intent中 就更简洁吗? eg:  如果我现在有  Activity A ,B ,C:现在我要把值通过A经过B传给C你怎么传 如果用Intent的话   A-B先写一

Activity之间的三种传值方式

*************************************** 第一种:Extras:额外的,附加的.在Intent中附加额外的消息 //传值 Intent intent = new Intent(this, XXXActivity.class); intent.putExtra(key, value); startActivity(intent); //取值 getIntent()方法得到intent对象 Intent intent = getIntent(); //获取Int

Android-Activity使用(2) -传值

一.简单传值 1.修改MainActivity protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //强制转换为Button,必然放在setContentView之后 btnSatrtAty1=(Button)findViewById(R.id.btnStartAty1); //给按钮设定事

Activity传值的几种方式

***Activity的传值 *第一种:Intent传值 主xml文件中设置按钮,点击跳转: <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/btn_name" android:onClick="send"/> //设置点击跳转事件 主Java代码中传值: p

Android四大组件--Activity详解

Android四大组件--Activity详解 分类: android android应用android开发 本文的主要内容包括1.activity的建立.配置和使用:2.activity的跳转和传值:3.startActivityForResult:4.activity的生命周期. 1.activity的建立.配置和使用 Activity是一个应用中的组件,它为用户提供一个可视的界面,方便用户操作,比如说拔打电话.照相.发邮件或者是浏览地图等.每个activity会提供一个可视的窗口,一般情况

Android Thread Handler UIHandler demos

extends:http://blog.csdn.net/superjunjin/article/details/7540064 序效果:为了显示如何用message传值的简单例子 例1,点击按钮,持续显示当前系统时间(bundle传值,耗时,效率低) 例2,点击按钮,progressbar持续前进(message方法传值,效率高,但只能传整型int和对象object) 例1,主activity  package com.song; import java.text.SimpleDateForm