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
          主站蜘蛛池模板: 桃园市| 六枝特区| 永春县| 阳朔县| 绵竹市| 辽源市| 棋牌| 大英县| 武穴市| 新竹市| 白水县| 山东省| 柏乡县| 汝州市| 仁布县| 栖霞市| 扎囊县| 额济纳旗| 五指山市| 珠海市| 定西市| 金昌市| 西林县| 凌云县| 武汉市| 如东县| 海阳市| 郓城县| 涟水县| 宝清县| 信宜市| 邛崃市| 新安县| 伽师县| 石门县| 申扎县| 保靖县| 浮梁县| 田阳县| 元阳县| 化隆|