I'm trying to create a swipe view as described here http://developer.android.com/training/implementing-navigation/lateral.html
I've created an action bar as per the documentation with final ActionBar actionBar = getActionBar();
but I get the following message
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setNavigationMode(int)' on a null object reference
which relates to this line actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
Now i've established that it's likely to do with my theme not having an action bar, see android:theme="@style/Theme.AppCompat.Light.NoActionBar">
, so I change my theme to say android:theme="@style/Theme.AppCompat.Light">
, but then I get the following message:
java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead
and all the answers on the internet say to change to a non action bar theme, which gives me the first error again. So I'm literally going around in circles. I want to basically have this action bar with tabs as described in the documentation.