当我切换到新选项卡时,Android Tabs崩溃
答
如何包装在一个try/catch东西可看的异常消息说什么?我做了类似的事情,这里是对我有用的东西:
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());
}
你会得到什么错误? –