洗尽铅华雨吧 关注:0贴子:54
  • 5回复贴,共1

android======bundle

只看楼主收藏回复



IP属地:江苏1楼2013-03-25 08:56回复
    Bundle类是一个key-value对
    两个activity之间的通讯可以通过bundle类来实现


    IP属地:江苏2楼2013-03-25 08:57
    回复
      比如text1跳转到text2
      Intent intent = new Intent();
      intent.setClass(TestBundle.this, Target.class);
      Bundle mBundle = new Bundle();
      mBundle.putString("Data", "data from TestBundle");//压入数据
      intent.putExtras(mBundle);
      startActivity(intent);


      IP属地:江苏3楼2013-03-25 09:00
      回复
        在text2中
        <span style="color:#ff6600;">Bundle bundle = getIntent().getExtras(); </span> //得到传过来的bundle
        String data = bundle.getString("Data");//读出数据
        setTitle(data);


        IP属地:江苏4楼2013-03-25 09:01
        回复
          handle与SharedPreferences的区别
          SharedPreferences是简单的存储持久化的设置,就像用户每次打开应用程序时的主页,它只是一些简单的键值对来操作。它将数据保存在一个xml文件中
            Bundle是将数据传递到另一个上下文中或保存或回复你自己状态的数据存储方式。它的数据不是持久化状态。


          IP属地:江苏5楼2013-03-25 09:02
          回复
            findview(),filldata()


            IP属地:江苏6楼2013-04-02 17:05
            回复