Map View Control Using An Intent In Xamarin Android App Using Visual Studio 2015


Xamarin is platform to develop the cross-platform and multi-platform apps. (Ex. Windows phone,android,ios) in the xamarin platform is code sharing concept used. in the xamarin studio is avialable in the visual studio also.

Map view control is how to view Map using an intent in xamarin android app.


  • Visual studio 2015 update 3

The following steps need to be followed in order to view map control use an Intent in Android app . using visual studio 2015.

Step 1

Click file--> Select New--> Next select Project. the project click after open the all type of projects. in the visual studio.

or click (Ctrl+Shift+N)

Step 2

After open the New Project Select Installed-->Templates-->Visual c#-->Android-->choose the Blank App (Android).

Next give your android app name(Ex:sample) and give path of your project. after give all click ok.

Step 3

Next go to the solution explorer. in the solution explorer is have the all files and source in your project.

Next Select Resource-->Layout-->double click to open main.axml page. you want select source to write the xaml code.

you want design choose the designer window you can design your app.

Step 4

After open the main.axml file will open the main page designer. in this page which type you want you can design this page.

Next Delete the Default hello world button

go to the source panel you can see the button coding. you will delete it.

After delete the xaml code next delete the c# button action code.

go to the MainActivity.cs page. you will delete the button code.

Step 5

Next go to the toolbox window in the toolbox window is have the all type of the tools and control.You will go to the toolbox window. next scroll down

you will see the all tools and control.

you will drag and drop the Button.

Step 6

Next go to the properties window you will edit the Button id value and Text Value(Ex:android:id="@+id/myButton" android:text="@string/hello" ).

Step 7

In this step go to the Main.axml page Source Panel. note the Button id Value.


  1. <LinearLayout xmlns:android=""  
  2.    android:orientation="vertical"  
  3.    android:layout_width="match_parent"  
  4.    android:layout_height="match_parent"  
  5.    android:minWidth="25px"  
  6.    android:minHeight="25px">  
  7. <Button  
  8.    android:id="@+id/myButton"  
  9.    android:layout_width="fill_parent"  
  10.    android:layout_height="wrap_content"  
  11.    android:text="@string/hello" />  
  12. </LinearLayout>  
Step 8

In this step open the String.xml page. Go to the Solution Explorer-->Resource-->values-->String.xml.

Step 9

After open the String.xml file Write the Following xml code.

  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <resources>  
  3.    <string name="hello">Launch Map</string>  
  4.    <string name="app_name">LaunchMaps</string>  
  5. </resources>

Step 10

Next go to the MainActivity.cs page. write the following code between the OnCreate() Method.

  1. protected override void OnCreate(Bundle bundle)  
  2. {  
  3.     base.OnCreate(bundle);  
  4.     // Set our view from the "main" layout resource  
  5.     SetContentView(Resource.Layout.Main);  
  6.     Button button = FindViewById < Button > (Resource.Id.myButton);  
  7.     button.Click += delegate {  
  8.         var geoUri = Android.Net.Uri.Parse("geo:42.374260,-71.120824");  
  9.         var mapIntent = new Intent(Intent.ActionView, geoUri);  
  10.         StartActivity(mapIntent);  
  11.     };  
  12. }  

Step 11

If you have Android Virtual device, run the app on it. Else, connect your Android phone and run the app in that.

Simply, connect your phone and go to Visual Studio. The connected phone will show up in the Run menu (Ex:LENOVO A6020a40(Android 5.1-API 22)). Click the Run option.


After a few seconds, the app will start running on your phone.

you can click the Lanch Map Button.

you can choose any map and click just once.

you will see the giving map location is successfully.


So, this was the process of map view control using an intent in xamarin android app, using Visual Studio 2015.