I have browsed the website for a bit and I can\'t find an answer to my problem, I am trying to get my Navigation Drawer to switch between activities instead of fragments. I
Suppose you have 5 items (from 0 index to 4), each index identifying an Activity of your project. You can create a method selectItem(int position)to know what drawer item has been chosen by user.
public void selectItem(int position) {
Intent intent = null;
switch(position) {
case 0:
intent = new Intent(this, Activity_0.class);
break;
case 1:
intent = new Intent(this, Activity_1.class);
break;
...
case 4:
intent = new Intent(this, Activity_4.class);
break;
default :
intent = new Intent(this, Activity_0.class); // Activity_0 as default
break;
}
startActivity(intent);
}
Finally, add this method to your DrawerItemClickListener :
private class DrawerItemClickListener implements ListView.OnItemClickListener {
@Override
public void onItemClick(AdapterView parent, View view, int position, long id) {
selectItem(position);
drawerLayout.closeDrawer(drawerListView);
}
}
It's easier than using Fragments, I think !!!