Android button to a certain URL

Hi everyone,
I’m quite new to coding in general.

Currently I’m unsure how to create buttons with an icon that when clicked, will go to a link (open the browser, or a certain app).

Is this possible to do at all?

Thanks.

Hi @Sakaso and welcome to the forums,

While I am not an Android dev, after some five minutes of searching I landed on this:

Hope it helps, the Xamarin help pages are hopeless for me…

Happy Coding!

Hi, thanks for the welcome!
Unfortunately I don’t believe that Xamarin.forms works on monogame. However, I will keep looking.

Thanks for your help!

I thought you had to use Xamarin/Xamarin.forms to make Android releases?

EDIT

Maybe?

Figured it out. Apparently Xamarin is kinda weird when I set the build target to android 5. It corrupted though haha, but when it reinstalls we’ll see what happens.
Thanks for the help!

Decided to paste both versions here:

http://cimg3.ibsrv.net/gimg/www.clublexus.com-vbulletin/512x384/80-jackie_chan_meme_by_firefox2014_d8p19a4_0c1015f6d9aaf67b14dc7697813b9d15aa9d9f7a.jpg

Yeah, I agree.
I’ve set the build target to 8.1 now though, so when it does install, we shall see what happens.

In order to open a link in android you’ll have to make an Intent

a quick google about how it may be done in xamarin gave me:

Device.OpenUri(new Uri("http://example.com"))

Hmmm…
It gives the exception “System.InvaidOperationException: You MUST call Xamarin.Forms.Init(); prior to using it”
However I am and it just doesn’t work.

Edit: Basically I get errors whenever I try to use Xamarin.Forms.Init

Okay I seemed to get it working!
Turns out I needed to do xamarin.forms.forms.init in activity1.cs
Gosh that’s a huge headache gone.


http://cimg3.ibsrv.net/gimg/www.clublexus.com-vbulletin/512x384/80-jackie_chan_meme_by_firefox2014_d8p19a4_0c1015f6d9aaf67b14dc7697813b9d15aa9d9f7a.jpg

I leave this one for those with more experience…….

1 Like