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

          Activity和Intent相關(guān)筆記

          Posted on 2016-10-26 00:54 leekiang 閱讀(274) 評論(0)  編輯  收藏 所屬分類: android
          向下一個Activity傳遞數(shù)據(jù)(使用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);
           
          對于數(shù)據(jù)的獲取可以采用:
          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跳轉(zhuǎn)到另外一個activity
          主站蜘蛛池模板: 陆川县| 甘南县| 贵州省| 六盘水市| 巴东县| 于田县| 谷城县| 揭东县| 连江县| 蓬溪县| 甘德县| 阳曲县| 淮安市| 武宣县| 胶州市| 潮安县| 新丰县| 广东省| 淮南市| 电白县| 大连市| 泗阳县| 武邑县| 梧州市| 林州市| 西城区| 六枝特区| 公主岭市| 晋宁县| 锡林浩特市| 内乡县| 黄平县| 容城县| 高州市| 永胜县| 五台县| 新野县| 云梦县| 南华县| 东乌| 东阳市|