title: Android: Failure delivering result ResultInfo
body: <p>I have an Activity A in <code>TabHost</code>, A <code>startActivityForResult(B)</code> then B <code>startActivityForResult(C)</code>.<br>
  The problem I meet is that:<br>
  In C when I setResult(RESULT_OK, intent), occur  </p>
  
  <pre><code>java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=Intent { (has extras) }} to activity {com.hackingtrace.vancexu/com.hackingtrace.vancexu.task.B}: java.lang.NullPointerException
  </code></pre>
  
  <p>In B, I start C by  </p>
  
  <pre><code>setTimeButton.setOnClickListener(new View.OnClickListener() {
  
          public void onClick(View view) {
              Intent i = new Intent(view.getContext(), TaskTimeSet.class);
              i.putExtra(TasksDbAdapter.KEY_ROWID, mRowId);
              Calendar c = Calendar.getInstance();
              Date d = c.getTime();               
              SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
              String now = sdf.format(d);
              i.putExtra("date", now);
  
              startActivityForResult(i, ACTIVITY_EDIT_TIME);
          }
  </code></pre>
  
  <p>and in C, I setResult by  </p>
  
  <pre><code>confirmBtn.setOnClickListener(new OnClickListener() {
  
          public void onClick(View v) {
              // TODO Auto-generated method stub
              Intent intent = new Intent();
              intent.putExtra("date", resultDate);
  
              int h = timePicker.getCurrentHour();
              int m = timePicker.getCurrentMinute();
              String time = "" +h+":"+m;
              Log.d(TAG, time);
              intent.putExtra("time", time);
  
              setResult(RESULT_OK, intent);
              finish();
          }
      });
  </code></pre>
  
  <p>then in B I receive the result by  </p>
  
  <pre><code>protected void onActivityResult(int requestCode, int resultCode,
          Intent intent) {
      Log.d(TAG, "I am in " + requestCode + resultCode);
      super.onActivityResult(requestCode, resultCode, intent);
      if (requestCode == ACTIVITY_EDIT_TIME) {
          if (resultCode == RESULT_OK) {
              Log.d(TAG, "OK time set");
              String[] dateArr = intent.getStringExtra("date").split("-");
              String[] timeArr = intent.getStringExtra("time").split(":");
              int year = Integer.parseInt(dateArr[0]);
              int month = Integer.parseInt(dateArr[1]);
              int day = Integer.parseInt(dateArr[2]);
              int hour = Integer.parseInt(timeArr[0]);
              int minute = Integer.parseInt(timeArr[1]);
              Log.d(TAG, ""+year+month+day+hour+minute);              
          }
      }
  }
  </code></pre>
  
  <p>But I never get the "Log.d(TAG, ""+year+month+day+hour+minute);" run normally.  </p>
  
  <p>I have tried:<br>
  1:  </p>
  
  <pre><code>if (getParent() == null) {
                  setResult(Activity.RESULT_OK, intent);
              }
              else {
                  getParent().setResult(Activity.RESULT_OK, intent);
              }
  </code></pre>
  
  <p>not work :(<br>
  2:  </p>
  
  <pre><code>i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  </code></pre>
  
  <p>the error "java.lang.RuntimeException" not occur, but the requestCode and resultCode is 0 always.  </p>