I have a class that extends FragmentActivity
to call the map, and other classes that are only Fragment
. How do I make the method to call the screens by NavigationDrawerFragment
?
I have a class that extends FragmentActivity
to call the map, and other classes that are only Fragment
. How do I make the method to call the screens by NavigationDrawerFragment
?
In your class where you have the navigation drawer create a method similar to this
public void selectItem(int position) {
int title = 0;
fragment = null;
boolean withTabs = false;
switch (position) {
case 1:
title = R.string.tipu_title;
fragment = new MainFragment();
withTabs = true;
break;
}
if (title != 0) {
setTitle(title);
}
mDrawerLayout.closeDrawer(menuList);
if (position != currentPosition) {
setCurrentPage(fragment, withTabs);
currentPosition = position;
}
}
Then in the classes where you want to go to another fragment, just call it that way
((ClasseNavigationDrawer)getActivity()).selectItem(position);