How can I open a URL in Android's web browser from my application?

前端 未结 30 2806
庸人自扰
庸人自扰 2020-11-21 22:09

How to open an URL from code in the built-in web browser rather than within my application?

I tried this:

try {
    Intent myIntent = new Intent(Int         


        
30条回答
  •  走了就别回头了
    2020-11-21 22:51

    The response of MarkB is right. In my case I'm using Xamarin, and the code to use with C# and Xamarin is:

    var uri = Android.Net.Uri.Parse ("http://www.xamarin.com");
    var intent = new Intent (Intent.ActionView, uri);
    StartActivity (intent);
    

    This information is taked from: https://developer.xamarin.com/recipes/android/fundamentals/intent/open_a_webpage_in_the_browser_application/

提交回复
热议问题