JBOSS 點(diǎn)滴

          豐豐的博客

          android跳轉(zhuǎn)到另一個(gè)類再返回當(dāng)前類和值

          第一步:在A類中點(diǎn)擊按鈕時(shí)調(diào)用B類
          A類中:
          int OUTBILL_CODE = 10;//全局啊
            case R.id.diyoutbill:
             intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
             intent.setClass(ctx, Itemdiydown.class);
             intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
             startActivityForResult(intent,OUTBILL_CODE);
             break;
          第二步:
          B類中:
                Bundle bundle = new Bundle();   
                bundle.putString("downtype",pubdowntype);
                bundle.putString("startDate",pubstartDate);
                bundle.putString("endDate", pubendDate);
             Itemdiydown.this.setResult(RESULT_OK, this.getIntent().putExtras(bundle));   
             Itemdiydown.this.finish();//關(guān)閉當(dāng)前窗口 
          第三類:
          返回A類中:
           protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            // TODO Auto-generated method stub
            super.onActivityResult(requestCode, resultCode, data);
            if (requestCode == OUTBILL_CODE&& resultCode == RESULT_OK) {//
              Bundle bundle = data.getExtras();
                    startDate = bundle.getString("startDate");
                    endDate = bundle.getString("endDate");
                    downtype = bundle.getString("downtype");
                    //執(zhí)行事件
            }
           }

          posted on 2015-05-23 16:59 半導(dǎo)體 閱讀(202) 評(píng)論(0)  編輯  收藏


          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 资溪县| 尉犁县| 西乌| 琼结县| 五台县| 阳山县| 铁岭市| 托克逊县| 库车县| 承德市| 青冈县| 林州市| 巴南区| 思南县| 城口县| 布尔津县| 天峻县| 闸北区| 太保市| 兴和县| 阿克陶县| 凌源市| 腾冲县| 安宁市| 平和县| 同德县| 蒙自县| 正镶白旗| 四川省| 吉林市| 南雄市| 河北区| 诸城市| 罗城| 竹溪县| 工布江达县| 东乌珠穆沁旗| 白玉县| 湖口县| 天长市| 崇阳县|