开发者

Android Tabs crashed while i switch to new tab

开发者 https://www.devze.com 2023-04-11 15:07 出处:网络
Please check what i did wrong in android tabs. whenever i switch to another tab, the a开发者_Go百科pplication crashed at the same time.

Please check what i did wrong in android tabs. whenever i switch to another tab, the a开发者_Go百科pplication crashed at the same time.

Here is the complete source code: http://dl.dropbox.com/u/16910648/Phase1.zip


How about wrapping things in a try/catch to see what the exception message says? I do something similar, here's what works for me:

try {

  final TabHost tabHost = getTabHost();

  tabHost.addTab(tabHost.newTabSpec("tab1")
         .setIndicator(mContext.getString(R.string.tab_label_game), res.getDrawable(R.drawable.ic_tab_state))
         .setContent(new Intent(this, ActivitySettingsStates.class)));

  tabHost.addTab(tabHost.newTabSpec("tab2")
         .setIndicator(mContext.getString(R.string.tab_label_alerts), res.getDrawable(R.drawable.ic_tab_alerts))
         .setContent(new Intent(this, ActivitySettingsAlerts.class)));
}
catch (Exception ex) {
  if (DEBUG) Log.e(TAG, PROC + ": Exception occurred: " + ex.toString());
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号