Issue
I am writing this cause I was searching for days to get an answer on my question but I didn't find any answers . . .
I am like for a month using android studio and everything is going perfect but . . . I cant find an solution to something, I added some buttons into a layout and I wat that when I click on the button it redirects me to my Webview. I want to use only one Webview and every time when I click one of the buttons it had to go to another website in the Webview. I tried many of things I found on SO but couldn't find the right answer.
Could you please help me?
Solution
Call WebView's loadUrl() method inside the listeners of your buttons:
my_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
my_webView.loadUrl("www.some_url.com");
}
});
You can always change your webview's url to what you need depending on the button you clicked.
Answered By - Miquel Perez
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.