Hello all,
I this blog we will discuss about another very important part of the building blocks of Xamarin.Android, that is Intent class.
The easiest way to understand the Intent is really an messaging object that you are to create and pass
that to off to either to some of the components of your application or to the Andriod.OS.
//Explicit intent
///Go from one screen to another
Intent intent = new Intent(this, typeof(UserDetailsActivity));
StartActivity(intent);
// Implicit intent
var uriWeb = Android.Net.Uri.Parse("https://www.gmail.com/");
Intent webIntent = new Intent(Intent.ActionView, uriWeb);
StartActivity(webIntent);
var geoUri = Android.Net.Uri.Parse("geo:42.374260,-71.120824");
var mapIntent = new Intent(Intent.ActionView, geoUri);
StartActivity(mapIntent);
var uriPhone = Android.Net.Uri.Parse("tel:1234356");
var phoneIntent = new Intent(Intent.ActionView, uriPhone);
StartActivity(phoneIntent);
By the help of Intent, we can handle some kind of Activity and Action that we want to perform. An Intent is a very multifunction object or class that can handle and create a specification of different types of messages to sent and handled appropriately.
0 Comment(s)