Answer the question
In order to leave comments, you need to log in
Android Follow Link App in Xamarin?
Good afternoon!
I have never dealt with C# and mobile app development. And this topic is not yet drawn.
I need to submit an elementary application on android through Xamarin, just a button that you click on and a link opens: https://kontur.ru/events/future
As I understand it, this is not difficult, but so far I can’t think of it.
Could someone suggest how this can be implemented?
Maybe something like that, but I'm not sure.
namespace App2
{
[Activity(Label = "Outline.Events", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
int count = 1;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
Uri MyButton = new Uri(@" www.bing.com ");
new Uri.Navigate(MyButton);
}
}
}
Answer the question
In order to leave comments, you need to log in
Everything is on the Xamarin site. developer.xamarin.com/recipes/android/fundamentals...
As far as I understand, opening in the built-in browser is enough for you, and not in the application itself through the
WebView, then this should be enough:
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
Button button = FindViewById<Button> (Resource.Id.myButton);
button.Click += delegate {
var uri = Android.Net.Uri.Parse ("https://kontur.ru/events/future");
var intent = new Intent (Intent.ActionView, uri);
StartActivity (intent);
};
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question