Opening Google Directions API internally Android Studio -


i developing application in android studio , have included both google maps api , google directions api within app. have included button in app allows user guided selected location.

the following code uses google maps api, opens google maps within application shows marker on maps without giving directions place:

 protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_maps);      supportmapfragment mapfragment = (supportmapfragment) getsupportfragmentmanager().findfragmentbyid(r.id.map);     mapfragment.getmapasync(this); }  @override public void onmapready(googlemap googlemap) {     mmap = googlemap;      // add marker @ oval , move camera     latlng oval = new latlng(53.3484013,-6.2605243);     mmap.addmarker(new markeroptions().position(oval).title("oval pub"));     mmap.movecamera(cameraupdatefactory.newlatlng(oval)); 

the below code uses google directions api , gives user guide selected destination:

@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_maps);       supportmapfragment mapfragment = (supportmapfragment) getsupportfragmentmanager().findfragmentbyid(r.id.map);     mapfragment.getmapasync(this); }  @override public void onmapready(googlemap googlemap) {     mmap = googlemap;      uri gmmintenturi = uri.parse("google.navigation:q=the+oval+bar,+dublin+ireland");     intent mapintent = new intent(intent.action_view, gmmintenturi);     mapintent.setpackage("com.google.android.apps.maps");     startactivity(mapintent); 

the problem being above code relating google directions api, opens google maps application outside application. wondering how open within application itself.

you should use fragment com.google.android.gms.maps.mapfragment shown in great lars vogel article: http://www.vogella.com/tutorials/androidgooglemaps/article.html


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -