android - Navigation Drawer shows error to the Java File when maps integrated -
i trying have navigation drawer, on of activity current location. when set code in drawer if statement error , doesnt give solution.
this mainactivity:
@suppresswarnings("statementwithemptybody") @override public boolean onnavigationitemselected(menuitem item) { // handle navigation view item clicks here. int id = item.getitemid(); fragmentmanager fragmentmanager = getfragmentmanager(); if (id == r.id.nav_home_layout) fragmentmanager.begintransaction().replace(r.id.newframelayout, new mapsactivitytest()).commit(); else if (id == r.id.nav_earning_layout) { fragmentmanager.begintransaction().replace(r.id.newframelayout, new earningactivity()).commit(); } else if (id == r.id.nav_campaign_layout) { fragmentmanager.begintransaction().replace(r.id.newframelayout, new campaignactivity()).commit(); } else if (id == r.id.nav_vehicle) { fragmentmanager.begintransaction().replace(r.id.newframelayout, new vehicle()).commit(); } else if (id == r.id.nav_alerts) { fragmentmanager.begintransaction().replace(r.id.newframelayout, new alerts()).commit(); } else if (id == r.id.nav_faqs) { fragmentmanager.begintransaction().replace(r.id.newframelayout, new faqs()).commit(); }else if (id == r.id.nav_track_location) { } else if (id == r.id.nav_send) { } drawerlayout drawer = (drawerlayout) findviewbyid(r.id.drawer_layout); drawer.closedrawer(gravitycompat.start); return true; }
mapsactivitytest() class shows error on if statement.
this mapsactivitytest()
public class mapsactivitytest extends fragment implements onmapreadycallback { private googlemap mmap; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_maps_test); // obtain supportmapfragment , notified when map ready used. supportmapfragment mapfragment = (supportmapfragment) getsupportfragmentmanager() .findfragmentbyid(r.id.map); mapfragment.getmapasync(this); } @override public void onmapready(googlemap googlemap) { mmap = googlemap; // add marker in sydney , move camera latlng sydney = new latlng(-34, 151); mmap.addmarker(new markeroptions().position(sydney).title("marker in sydney")); mmap.movecamera(cameraupdatefactory.newlatlng(sydney)); }
}
Comments
Post a Comment