I am trying to have a a progress dialog open when polling my server. The class is an ActivityGroup because it is nested within a tab bar. To keep the view within the frame, the
If getParent() doesn't work for you, try using just TabsActivity.context
(or substitute the name of your parent tab activity class). I am using nested activities and as a result using getParent() is still not returning the right context for the dialog, since it needs the context of the activity extending TabsActivity, not the immediate parent.
Simple fix:
You'll need to create a context variable in the TabsActivity class. Something like public static TabsActivity context;
and context=this
in the onCreate method.
Replace this line where you create the dialog:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
With:
AlertDialog.Builder builder = new AlertDialog.Builder(TabsActivity.context);
and it works like a charm.