android - How do I programmatically show a specific location in google map? -
so have come here ask again. googled lot on issue. there many solutions , confusing. moreover, of them done in eclipse, said change path, intigrate eclipse , bla bla...
problem description:
in application (in android studio), have item named map view , want user clicks on it, should take map view page , locate address (i have mentioned in code) in map. how that?
dummycontent:
................................ ................................ static { // add 4 sample items. additem(new dummyitem("1", "shopping center details")); additem(new dummyitem("2", "homepage")); additem(new dummyitem("3", "contact")); additem(new dummyitem("4", "map view")); } ................................. ..............................
itemdetailfragment:
................. .................... }else if(mitem.equals("4")){//4. map view /*locate following address in google map: times square manhattan, ny 10036 united states */ rootview = inflater.inflate(r.layout.fragment_map_detailed, container, false); webview webview = (webview) rootview.findviewbyid(r.id.webview2); webview.setwebviewclient(new webviewclient()); } .............................. ......................
fragment_map_detailed.xml:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:weightsum="1"> </linearlayout>
you might want display markers, placed on map when start activity. markers doesn't operate or adresses on coordinates. adress mentioned this:
@override public void onmapready(googlemap map) { map.addmarker(new markeroptions() .position(new latlng(40.758887, -73.985152)) .title("the times square")); }
more info markers: https://developers.google.com/maps/documentation/android/marker more info starting map activities (you must there if haven't done yet): https://developers.google.com/maps/documentation/android/start
Comments
Post a Comment