How do I center my Google Map Android application to provided coordinates? -


i need find out how can move android googlemap programmatically. got map working, need add functionality of centering map specific coordinates given me google geocoder httprequest. got coordinates out of response google, have not found way move map said point.

i'm getting in trouble reference assemblies. i'm using xamarin c# , seems tutorials , examples in java , calls stuff totally different , need stuff not here in c#.

  • how map move desired location on map?
  • and how place marker on point?

also please add names of necessary reference assemblies on answer i'll know add/use.

thank you

.

here's relevant code:

mapsactivity.cs

public class mapsactivity : fragmentactivity {     query q;     int late6, lone6;     latlng coordinates;      protected override void oncreate(bundle bundle)      {         base.oncreate(bundle);         setcontentview (resource.layout.map);          edittext stext = findviewbyid<edittext> (resource.id.et_location);         button fbutton = findviewbyid<button> (resource.id.btn_find);         fbutton.click += (sender, e) => {             q = new query(stext.text);             q.createquery();             var result = q.responsefromgoogle.results.find (item => item.geometry.location.lat.tostring("f") != null);             stext.text = result.geometry.location.lat.tostring("f") + " " + result.geometry.location.lat.tostring("f");              coordinates = new latlng(result.geometry.location.lat, result.geometry.location.lng);         };     } } 

androidmanifest.xml

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versioncode="1" android:versionname="1.0" package="igluharkka2.igluharkka2"> <uses-sdk android:minsdkversion="7" /> <application android:label="@string/app_name">     <uses-library android:name="com.google.android.maps" />     <!-- put google maps v2 api key here. key not work you.-->     <!-- see https://developers.google.com/maps/documentation/android/start#obtaining_an_api_key -->     <meta-data android:name="com.google.android.maps.v2.api_key" android:value="xxxxxxxxxx" /> </application> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="com.google.android.providers.gsf.permission.read_gservices" /> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.access_fine_location" /> <uses-permission android:name="android.permission.access_location_extra_commands" /> <uses-permission android:name="android.permission.access_wifi_state" /> <uses-feature android:glesversion="0x00020000" android:required="true" /> 

map.xml

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".mainactivity"> <relativelayout     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:orientation="horizontal">     <button         android:id="@+id/btn_find"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@string/str_btn_find"         android:layout_alignparentright="true" />     <edittext         android:id="@+id/et_location"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:inputtype="text"         android:hint="@string/hnt_et_location"         android:layout_toleftof="@id/btn_find" /> </relativelayout> <fragment     android:id="@+id/map"     android:layout_width="match_parent"     android:layout_height="match_parent"     class="com.google.android.gms.maps.supportmapfragment" /> 

here summery of how change how map shown. part under change camera position tou.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -