Open a websitelink inside an android app with dynamically generated links
I'm reading in an XML-file and one of these attributes is the article url.
A link, that - when clicked - navigates the user to the web page with his
standard browser.
I realized making the link clickable with the Linkify-method
articleURL[i].setText("Article-URL: " + Html.fromHtml("<a href='" +
((Node) articleURList.item(0)).getNodeValue() + "'>" + ((Node)
articleURList.item(0)).getNodeValue() + "</a>"));
Linkify.addLinks(articleURL[i], Linkify.ALL);
When I now click the link it opens up the website in my browser. What I
want to achieve now, is to open the web page in the same app. I've tried
it like that
String article = ((Node) articleURList.item(0)).getNodeValue()
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(article));
startActivity(browserIntent);
But this starts the browser as soon as the part is reached. And since it's
in a for loop to gather all information from the XML file it will directly
open the first web page linked there.
What I want to achieve now is that the app opens the website in the app
itself when the user clicks on the linkified link.
The data I have from the XML file gets 25-50 data sets. And to display
them I run a for loop. Now I just want, that, when the user clicks on one
of the 25 links, that the app starts its own browser (without address bar)
and just opens the website. How can I achieve this?
No comments:
Post a Comment