We have an app that loads some web pages using Webview, but we want to aim the user only to specific links (or limit the user to specific links).
I want the people using this tutorial to be able lo load onlyFirstdroid (that is us, in case you did not notice) webpages. And if they try to use links outside our homepage to do nothing in this case. For this tutorial you will need little background of how to use Webview layout, you can check that in our previous tutorials: “Using WebView with Multi-touch – Android Tutorial”.
Let’s Start
The override is very simple, you just need to add some code into the class you are using to load the URL’s into the Webview. For the purpose of giving a complete example, I’ll first show the code we need to add, and then add this code to the previous example (Click here to see example)
Java Code
and also this line
Now let’s see this the whole source file of our example:
UsingMyWebview.java
That’s it, we finished. Now the user of your App will go only where you want them to go.
Any Question or Remark, please comment
Thanks
akm
www.cdacians.com
I want the people using this tutorial to be able lo load onlyFirstdroid (that is us, in case you did not notice) webpages. And if they try to use links outside our homepage to do nothing in this case. For this tutorial you will need little background of how to use Webview layout, you can check that in our previous tutorials: “Using WebView with Multi-touch – Android Tutorial”.
Let’s Start
The override is very simple, you just need to add some code into the class you are using to load the URL’s into the Webview. For the purpose of giving a complete example, I’ll first show the code we need to add, and then add this code to the previous example (Click here to see example)
Java Code
and also this line
Now let’s see this the whole source file of our example:
UsingMyWebview.java
That’s it, we finished. Now the user of your App will go only where you want them to go.
Any Question or Remark, please comment
Thanks
akm
www.cdacians.com
No comments:
Post a Comment