AllInWorld99 provides a reference manual covering many aspects of web programming, including technologies such as HTML, XHTML, CSS, XML, JavaScript, PHP, ASP, SQL,FLASH, jQuery, java, for loop, switch case, if, if else, for...of, for...in, for...each,while loop, blogger tips, blogger meta tag generator, blogger tricks, blogger pagination, client side script, html code editor, javascript editor with instant output, css editor, online html editor, materialize css tutorial, materialize css dropdown list,break, continue statement, label,array, json, get day and month dropdown list using c# code, CSS button,protect cd or pendrive from virus, cordova, android example, html and css to make android app, html code play,telerik show hide column, Transparent image convertor, copy to clipboard using javascript without using any swf file, simple animation using css, SQL etc. AllInWorld99 presents thousands of code examples (accompanied with source code) which can be copied/downloaded independantly. By using the online editor provided,readers can edit the examples and execute the code experimentally.


     Webview is a tool in android studio and it is used to load html or website to mobile, through this we can easy to create the android application through html,css and javascript code.

1) First create a new project in android studio more details...

2) Open activity_main.xml file under the layout folder.

Open layout.xml file in android studio


3) Copy the following code to the activity_main.xml

<WebView  xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/webview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
/>

xml code for creating webview


     When you add the code to activity_main.xml you can see the preview by clicking Design.


Webview Preview in design tab

4) You must set internet permission in AndroidManifest.xml. Open AndroidManifest.xml file and enter the following code.

<uses-permission android:name="android.permission.INTERNET" />

add android.permission.Internet user permission in android

5) Open MainActivity.java file and modify it by the below steps.
  
    a) import the following class
import android.webkit.WebView;
import android.webkit.WebViewClient;

    b) When you want to load the url to your webview, just call the below code.
        WebView myWebView = (WebView) findViewById(R.id.webview);
        myWebView.setWebViewClient(new WebViewClient());
        myWebView.loadUrl("http://www.google.com");


Java code for webview

6) Now you are done with your first webview, just run the code.


Java code for webview final output





0 comments:

Post a Comment

Notification

Total Pageviews