2界面的传值

A跳到B

   Intent intent=new Intent(Discount1Activity.this, DisscountListActivity.class);
   startActivityForResult(intent,410);

B界面返回A

       //这是虚拟键
       @Override
   public boolean onKeyUp(int keyCode, KeyEvent event) {
    Intent mIntent = new Intent();
    mIntent.putExtra("cardId", "-1");
    mIntent.putExtra("cardUrl","");
    // 设置结果,并进行传送
    setResult(410, mIntent);
    return super.onKeyUp(keyCode, event);
   }
    //这是确定是要返回的值
   Intent mIntent = new Intent();
    mIntent.putExtra("cardId", data.get(postion).getId());
    mIntent.putExtra("cardUrl", data.get(postion).getImage());
    // 设置结果,并进行传送
    setResult(410, mIntent);
    finish();

你可能感兴趣的:(2界面的传值)