title: TabActivity with ActivityGroup and PreferenceActivity child
body: <p>I have a TabActivity where each tab has ActivityGroup.
  On the home ActivityChild of the first group I have an menu option, which gives to the user the option to open preferences.
  When I click "Preferences" on menu, I start PreferenceActivity inside ActivityGroup, which shows PreferenceActivity on the first tab.
  The problem is when I click on any specific preference which has to show a Dialog (for EditTextPreference).
  I have the following exception:</p>
  
  <pre><code>android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@405d3a20
  </code></pre>
  
  <p>I understand that the problem is because Dialog to be shown by PreferenceActivity uses wrong context, BUT i don't now how change the context of created dialog. </p>
  
  <p>Belows is the PreferenceActivity I've created. </p>
  
  <pre><code>public class PreferencesActivity extends PreferenceActivity  implements OnSharedPreferenceChangeListener{
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.preferences);
          addPreferencesFromResource(R.xml.preferences);
          SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
          prefs.registerOnSharedPreferenceChangeListener(this);
      }
  
      @Override
      public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,String key) {     
  
      }   
  }
  </code></pre>
  
  <p>I don't want to create custom dialogs. I want to use the mechanism of PreferenceActivity for that.
  Below is the code that I'm using to add to group:</p>
  
  <pre><code>i = new Intent(MyActivity.this, PreferencesActivity.class);
  TabGroupActivity parentActivity = (TabGroupActivity) getParent();
  parentActivity.startChildActivity("PreferencesActivity", i);
  </code></pre>
  
  <p>Any ideas?</p>