I've checked other similar posts and can't find a solution. I have had trouble with a null pointer upon calling getActionBar()
, I seemed to have solved that by using getSupportActionBar()
. My app now runs but my nav drawer does not open.
Here is my base activity, all other activities extend this BaseActivity:
* This activity will add Navigation Drawer for our application and all the code related to navigation drawer.
* We are going to extend all our other activites from this BaseActivity so that every activity will have Navigation Drawer in it.
* This activity layout contain one frame layout in which we will add our child activity layout.
*/
Here is the XML for BaseActivity's view:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:id="@+id/content_frame"
android:theme="@android:style/Theme.WithActionBar"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ListView
android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#888888"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp" />
</android.support.v4.widget.DrawerLayout>
My minSdkVersion is 16 and I'm using the standard @style/AppTheme
which uses Theme.AppCompat.Light as its parent.
The code runs fine with no errors but the navigation drawer just won't open.
Any help is greatly appreciated, thanks in advance!