title: Android Intent Activity Callback
body: <p>I'm developing an Android module that basically consists of a custom View third parties can just drop into any of their activities.
  This module includes a configuration activity (based on PreferenceActivity).</p>
  
  <p>Given that you can't start an activity from a View, the module calls 'openConfig(Intent intent)' on the activity it is displayed in. This activity acts as a delegate for the module.</p>
  
  <p>That works fine thus far (though I'd really like the module to handle everything internally, no delegate methods required, but I reckon that just isn't possible).
  However, I need some sort of callback from the preference activity to the module, so that the module will get notified when the settings have been changed.</p>
  
  <p>I was thinking of just adding the module's main class as a delegate to the preference activity;</p>
  
  <pre><code>ConfigActivity a = new ConfigActivity();
  a.testVar = "testtest";
  Intent intent = new Intent(getContext(), a.getClass());
  delegate.handleConfigAction(intent); //
  </code></pre>
  
  <p>However, this test with just a simple String (instead of an interface) showed, that the String wouldn't get set after the activity has been started.</p>
  
  <p>Second thought was to use 'putExtra()' on the intent, but that doesn't really suit the use case as the delegate I'd like to put there really is a View and not a serializable data object.</p>
  
  <p>Are there any ways for me to handle this internally? I am aware of the 'onActivityResult()' function (<a href="http://developer.android.com/training/basics/intents/result.html" rel="nofollow">http://developer.android.com/training/basics/intents/result.html</a>), but that would mean that the third party developer using my module would need to handle this, something that needs to be avoided for obvious reasons.</p>
  
  <p>Any help would be highly appreciated!</p>
  
  <p><strong>EDIT: FINAL SOLUTION</strong>
  In the end I've changed the module from View to Fragment, which now works much better with handling "child" activities and such. When starting an Activity from a Fragment, the 'onActivityResult' function works beautifully to accomplish the task at hand.</p>