I am struggling to get the Navigation drawer items to register and start and intent for a new activity. The drawer opens fine and is displayed correctly but nothing happens
It seems like the your DrawerItemClickListener.class does not work as the only time the selectItem() method is called is at the end of your activities onCreate() at selectItem(0);
Instead of calling
mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
you can use this as a parameter and let you Activity implement the ListView.OnItemClickListener itself.
public class MyActivity extends Activity implements ListView.OnItemClickListener {
public void onCreate(Bundle savedInstanceState) {
[...]
mDrawerList = (ListView) findViewById(R.id.left_drawer);
[...]
mDrawerList.setOnItemClickListener(this);
[...]
}
[...]
@Override
public void onItemClick(AdapterView> parent, View view, int position, long id) {
selectItem(position);
}
private void selectItem(int position) {
switch (position) {
case 1:
[...]
startActivity(new Intent(this, SplashScreen.class));
break;
[...]
default:
break;
}
[...]
}
[...]
}