Skip to content
Advertisement

How to open URL from ListView inside fragment?

Wanna make to open website when I click it from ListView. I made it with some youtube videos. Mixed up those youtube videos and of course, It’s not working. What should fix or add more code? I put my every codes to understand it. Need you guys help a lot.

JavaScript
JavaScript

Two upper codes are for layout.

JavaScript
JavaScript
JavaScript

And last 3 codes are for class. It’s really hard to make it. Please, Help me!

Advertisement

Answer

Currently according to your code above when you click on a ListView item you are trying to open a url using the below Intent which is failing to construct a url from an ArrayList:

JavaScript

You should get the clicked item url first to be able to construct a valid url like below:

JavaScript

An example of a sample url link based on your code redirecting to the specific url will be like below:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement