title: Handling onActivityResult from outside the Activity
body: <p>I'm trying to make a helper class to start an <code>Activity</code> and get the return result (<code>startActivityForResult</code>) to avoid developers writing their own <code>onActivityResult</code> code and encapsulate the complex internal details.</p>
  
  <p>ie: the caller's code:</p>
  
  <pre><code>MyIntent i = new MyIntent();
  i.getMyData(new OnData() { public void onData(Bundle data) {....} );
  </code></pre>
  
  <p>I tried creating a "dummy" <code>Activity</code> inside MyIntent just to be able to override <code>onActivityResult</code>, but the activity needs to be declared in the manifest, which is what the helper class tries to avoid. There is no "setOnActivityResult" which would be a good alternative.</p>
  
  <p>So, how to create an <code>Activity</code> programmatically and "attach" it so it has valid state?</p>
  
  <p>After creating <code>new Activity()</code> I'd like to call the Activity "attach" which is internal.</p>