Alert dialog is a important part of any application. Conveying various information, error messages and even for taking confirmations from user can be done through alert dialog. Xamarin provides it’s own way of showing alert and conveying messages to the user.
Alerts in Xamarin are, an object of AlertDialog.Builder class, where AlertDialog is a subclass of Dialog class. Builder() is a method of AlertDialog class, which creates an alert dialog to display. We can add multiple buttons to this alert dialog. The builder takes the current context (Activity) and shows the Alert Box in the main thread(The UI thread). Continue reading →
Xamarin provides different layout for designing the user interface in Android.
Some common ones being used are Relative Layout, Linear Layout, Grid Layout, Table Layout, Frame Layout etc. Most of them are understandable from their name itself. Here we will discuss about how to design using Relative Layout in Xamarin for Android.
As the name suggests, Relative Layout mainly makes use of the controls present in the Designer and places controls relatively to each other. The most important aspect of this design being the First element placed inside the tag. The places itself depending on the properties set for the children in the Relative Layout.
For example: Continue reading →
In this Article, we will see how to create multiple screens in Android using Xamarin and pass data between them.
Android applications consist of a set of loosely coupled screens, represented by Activity classes.
Since each Activity is essentially decoupled from others, there needs to be a way to launch them and optionally pass data to them. On Android this is accomplished using Intents.
Intents are the classes that describe a message, both what the desired action of the message is and a data payload to send along with it. They are commonly used within applications to launch Activities. To launch a new Activity, we create a new Intent, set the Context and the Activity class to launch and then tell the OS to handle the Intent, which launches the Activity. Continue reading →
Mobile devices are smart enough to provide the geo-location coordinates by consuming the GPS API embedded inside.
Let’s get the geo-coordinates and a street address which is close to the location using Xamarin. In the below example I have demonstrated the same in Android environment.
Following are few steps
After creating a new Xamarin Android app add some common permission in AssemblyInfo.cs