title: Android retrieving result on onActivityResult from another activity using bundle
body: <p>Hello everyone if you would kindly help me. I'm stuck on how to retrieve the bundle data from another activity. Basically I have two activities which is that when I pressed a button on the first activity, it will go on the second activity and then sets the string values which is later on to be passed on the first activity. What I did was I used the bundle to put the string values. My question is that how can I get the bundle values (of strings) from the second activity and return it on to the first activity? Here is my code:</p>
  
  <p><strong>FirstActivity (going on to second activity):</strong></p>
  
  <pre><code>button1.setOnClickListener(new OnClickListener() {
              @Override
              public void onClick(View v) {
                  startActivityForResult(new Intent(this,
                          SecondActivity.class), REQUEST_CODE_SAMPLE);
              }
          });
  </code></pre>
  
  <p><strong>SecondActivity: (returning the bundle value)</strong></p>
  
  <pre><code>button2.setOnClickListener(new OnClickListener() {
                      @Override
                      public void onClick(View v) {
                          Bundle b = new Bundle();
                          bundle.putString("A", "Aloha");
                          bundle.putString("B", "Bubbles");
  
              setResult(
                      Activity.RESULT_OK,
                      getIntent().putExtras(b));
                      }
                  });
  }
  </code></pre>
  
  <p><strong>FirstActivity (going to retrieve the bundle values):</strong></p>
  
  <pre><code>@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
  
      switch (requestCode) {
      case REQUEST_CODE_SAMPLE:
          if (resultCode == RESULT_OK) {
                  bundle = getIntent().getExtras();
                  //WHAT TO DO TO GET THE BUNDLE VALUES//
                  String a = //STORE FIRST VALUE OF BUNDLE
                  String b = //STORE SECOND VALUE OF BUNDLE
          }
  
          break;
  
      default:
          break;
      }
  }
  </code></pre>