java - My app crashes when I press navigation item twice using map View -
this onnavigationitemselected method:
}
do this:
int id = item.getitemid(); fragmenttransaction fragmenttransaction; if (id == r.id.nav_sports) { fragment = new fragmentone(); } else if (id == r.id.nav_food) { fragment = new fragmenttwo(); } else if (id == r.id.nav_security) { fragment = new fragmentthree(); } if (fragment != null) { fragmenttransaction = getsupportfragmentmanager().begintransaction(); fragmenttransaction.replace(r.id.containerview, fragment).commit(); }
Comments
Post a Comment