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());
}
精彩评论