它在此行显示NullPointerException
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
我猜我在确切位置使用了requestWindowFeature
。
@Override
public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(com.actionbarsherlock.view.Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
mViewPager = new ViewPager(this);
mViewPager.setId(R.id.pager);
setContentView(mViewPager);
ActionBar bar = getSupportActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
mTabsAdapter = new TabsAdapter(this, mViewPager);
mTabsAdapter.addTab(bar.newTab().setText("Featured"),
EventsFeatured.class, null);
mTabsAdapter.addTab(bar.newTab().setText("All"), EventsAll.class, null);
mTabsAdapter.addTab(bar.newTab().setText("Nearby"), EventsNearBy.class,
null);
}
您可以在http://pastebin.com/74a8shqs
找到完整的代码logcat的: