Intent 界面双向传值

  public void push(View v){
        
        Intent it = new Intent();
        it.setClass(this, MainActivity_b.class);
        it.putExtra("name", "xaioer");
        startActivityForResult(it, 0);
    }
    
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        // TODO Auto-generated method stub
        super.onActivityResult(requestCode, resultCode, data);
        
        
        System.out.println(resultCode+"====================================");
        
    }
public void back(View v){
        Intent intent = new Intent();
        intent.putExtra("sb", "haha");
        setResult(3, intent);
        finish();
    }
    

你可能感兴趣的:(Intent 界面双向传值)