title: android why is TabActivity with Activity's crashing when open Dialog
body: <p>I see there are like 10 answers for this question and I have read them all
  but cannot get this to work.</p>
  
  <p>Im moving my activity's into this <code>TabGroup</code> and I have 3 activity's inside a tabgroup and got help doing it from here:  <a href="http://ericharlow.blogspot.com/2010/09/experience-multiple-android-activities.html" rel="nofollow">Multiple Android Activities in a TabActivity</a></p>
  
  <p>When opening a Custom Dialog i get this error:</p>
  
  <blockquote>
    <p>07-12 10:07:56.985: ERROR/AndroidRuntime(9532): android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@462d96f0 is not valid; is your activity running?</p>
  </blockquote>
  
  <p>I know this error say that Context is bad.<br>
  On the <code>ColorPickerView</code> (below) that doesn't work, I'm debugging and can see the Constructor doing it's job but as soon as constructor finish it crashed.</p>
  
  <p>The thing is I have 3 similar errors from the other two activities, one CheckBox, and two Spinner's.<br>
  I could easily fix it by changing the Context appropriately .</p>
  
  <p>This on is more complicated and the View stack looks like this: </p>
  
  <pre><code>TabGroup  
  .......TabHost (public class FileEditMainActivity extends Activity)    
  ...............ImageView (public class FileEditImageView extends ImageView )      
  ........................Dialog (public class ColorPickDialog extends Dialog )  
  ..............................View (private class ColorPickerView extends View  )
  </code></pre>
  
  <p>No matter how i change the Context the system tells my that the Context is not alive.<br>
  The <code>ColorPickerView</code> is always crashing..</p>
  
  <p>Must say also that this is working if i dont use the <code>TabGroup</code>.
  When I put the <code>FileEditMainActivit</code> in the TabGroup something goes wrong with the Context.<br>
  Anyone have an ide of what to do?</p>