c# - Can you help me with my code? -
using android.app; using android.widget; using android.os; using system; using android.content; using android.runtime; using android.views; using android.gms.maps; using android.gms.maps.model; using system.configuration; namespace googlemaps { [activity(label = "googlemaps", mainlauncher = true, icon = "@drawable/icon")] mainactivity public class mainactivity: activity, ionmapreadycallback { private googlemap gmap; protected override void oncreate(bundle bundle) { base.oncreate(bundle); // set our view "main" layout resource setcontentview(resource.layout.xmlfile1); setupmap(); } private void setupmap() { if (gmap == null) { mapfragment mapfragment = (mapfragment)fragmentmanager.findfragmentbyid(resource.id.map).getmapasync(this); } } public void onmapready(googlemap googlemap) { markeroptions markeroptions = new markeroptions(); markeroptions.setposition(new latlng(16.03, 108)); markeroptions.settitle("my postion"); googlemap.addmarker(markeroptions); googlemap.uisettings.zoomcontrolsenabled = true; googlemap.uisettings.compassenabled = true; googlemap.movecamera(cameraupdatefactory.zoomin()); } } }
and
'fragment' not contain definition 'getmapasync' , no extension method 'getmapasync' accepting first argument of type 'fragment' found (are missing using directive or assembly reference?) googlemaps
thank in advance
your method "onmapready" needs override base class's method.
public override void onmapready(googlemap gmap) { //dostuff }
i'm not 100% because i've never done specifically, i'm it's complaining callback method.
i used this find out. native java android development, translates pretty on xamarin experience.
Comments
Post a Comment