MDA/MDD/TDD/DDD/DDDDDDD
          posts - 536, comments - 111, trackbacks - 0, articles - 0
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          Activity和Intent相關筆記

          Posted on 2016-10-26 00:54 leekiang 閱讀(266) 評論(0)  編輯  收藏 所屬分類: android
          向下一個Activity傳遞數據(使用Bundle和Intent.putExtras)
          Intent it = new Intent(Activity.Main.this, Activity2.class);
          Bundle bundle=new Bundle();
          bundle.putString("name", "This is from MainActivity!");
          it.putExtras(bundle);       // it.putExtra("name","abc");
          startActivity(it);            // startActivityForResult(it,REQUEST_CODE);
           
          對于數據的獲取可以采用:
          Bundle bundle=getIntent().getExtras();
          String name=bundle.getString("name");

          參考:
          http://www.cnblogs.com/feisky/archive/2010/01/16/1649081.html
          http://www.cnblogs.com/tornadomeet/archive/2012/07/28/2613617.html 從一個activity跳轉到另外一個activity
          主站蜘蛛池模板: 府谷县| 兴化市| 托里县| 新津县| 六枝特区| 文水县| 略阳县| 温州市| 泰宁县| 子长县| 新巴尔虎右旗| 定西市| 民和| 章丘市| 琼海市| 柯坪县| 达拉特旗| 霍城县| 通州市| 祁东县| 天门市| 蓬安县| 伊吾县| 阿图什市| 碌曲县| 镇原县| 马鞍山市| 安达市| 巨鹿县| 东光县| 关岭| 永福县| 辽源市| 甘肃省| 肇州县| 同仁县| 万全县| 阿鲁科尔沁旗| 云林县| 阜宁县| 清远市|