0

my app is crashing, when I am going to add Activity which extends TabGroupActivity into TabHost.Fallowing is the code. When I directly add HomePage, everything works fine, But when HomePageTabGroup is added, app unfortunately closed.

MainTabHost.java

public class MainTabHost extends TabActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.maintabhost);

    final TabHost tabHost = getTabHost();
    //tabHost.getTabWidget().setDividerDrawable(R.drawable.tab_divider);


    // Tab for Home
    TabSpec home = tabHost.newTabSpec("Current Jobs");
    // setting Title and Icon for the Tab
    home.setIndicator("Current Jobs",getResources().getDrawable(R.drawable.icon_home_tab));
    Intent homeIntent = new Intent(MainTabHost.this, HomePageTabGroup.class);
    home.setContent(homeIntent);

   // Adding all TabSpec to TabHost
    tabHost.addTab(home); // Adding home tab

    }
}

HomePageTabGroup.java

public class HomePageTabGroup extends TabGroupActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    startChildActivity("HomePage", new Intent(HomePageTabGroup.this, HomePage.class));
    }

}
Umesh Suryawanshi
  • 934
  • 1
  • 7
  • 21

1 Answers1

0

finally I got my answer.

At HomePage, there was a custom Progress Dialog,

UmeshCustomProgressHUD.show(HomePage.this,"Loading\nPlease wait!", true,true,this);

Everything happened due to above line. I replaced

HomePage.this 

with

HomePageTabGroup.ctx, 

where ctx is defined as static Context in HomePageTabGroup. These two lines of code resolves my issue.

Umesh Suryawanshi
  • 934
  • 1
  • 7
  • 21