Android Article - How to Implement Android Libaries
GoTo: Make Your Own Android App Free | View Android Articles

What Is A Webview

If you have a clickable link in your app and you click on it: example; androidappcoding.com, a prompt will load asking you which browser you want to use to goto that link.
With 'WebView' added to your app code; and you click on that same link, android system automatically loads the link (website) into the webview, without presenting you with a prompt for browser. If your developing an app that requires considerable internet access then you you may want to implement a WebView.

Coding Tips For Implementing a WebView


Typically, a WebView requires 2 layout files -Examples: main.xml and webview.xml (both XML files) as well as 2 activity classes:MainActivity.java and WebViewActivity.java(java files).
Also, your manifest.xml file would need to declare the 'internet permission' code.

XML FILES
Layout files are placed in the resources folder;

In AIDE, the file hierachy would look like this:

AppProjects/WebviewTutorial/res/layout/main.xml
AppProjects/WebviewTutorial/res/layout/webview.xml

JAVA FILES
Java files are placed in the src folder;

In AIDE, the file hierachy would look like this:

(You can name 'WebviewTutorial' to whatever you like)

AppProjects/WebviewTutorial/src/com/acw/webview/MainActivity.java
AppProjects/WebviewTutorial/src/com/acw/webview/WebViewActivity.java
(the com/acw/webview is the app package name .apk-you can name this whatever you like when your first create your app)


MainActivity.java is for the button -where the user clicks the link


WebViewActivity.java is for the webview - where the website will load

MANIFEST FILE

The manifest file is located at the root of your app project files; AppProjects/WebViewTutorial/manifest.xml

Webview requires 'internet permissions' and this is coded in the manifest file.






For additional reading
Developer.android.com - WebView

You May Also Like These Android Articles: How To Scroll A View Android | How To - Android Libraries



If you Like Our Free Android Articles - Give Us a Social Mention Share