how to run HTML+CSS+JAVASCRIPT Project on android Emulator


Tags: javascript,android,html5,css3

Problem :

My Project is in HTML 5, CSS3,JavaScript. My project is perfectly work in internet browser(either using localhost or server)

Now i want to run my project on android Emulator. i am using http://'localhost':8036/login or http://'AndroidLocalhostipaddress':8036/login to run project on browser. and also try to copy my project in asset folder(web-view technique)but it is not work? My project correctly work in iPad(iPhone) but in Android it not work.

First tell me any code conversion required to run on Emulator.



Solution :

use a WebView view in your layout XML file:

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

use this code in your activity onCreate() method:

WebView mwebview = (WebView) findViewById(R.id.my_webview);
        mWebView.loadUrl("file:///android_asset/test.html");
        mWebView.getSettings().setJavaScriptEnabled(true);

And, mWebView.loadUrl("file:///android_asset/myfile.html"); works under all API levels.

I still not figure out why mWebView.loadUrl("file:///android_res/raw/myfile.html"); works only on API level 8. But it doesn't matter now.

try this code. hope it helps you.


    CSS Howto..

    How to apply a defined class to a new class in my css?

    How to make circles repeat in the background of an element in full CSS?

    How to Fix this CSS and Center the Menu Horizontally?

    How to fix Conflicting responsive menu Css and Colorbox css?

    how to change browsers default scrollbar using css or jquery

    How to have two background-images with CSS? [duplicate]

    JQuery UI Elements' Image not shown

    How to make a line in a table with CSS

    How to make link unclickable using CSS or jquery? [duplicate]

    How to get the CSS-Code and save in a String?

    How to achieve a left and right background split leaving middle div visible?

    How to make a barlike chart but only with html and css [closed]

    how to keep table 100% wide?

    How to avoid Zalgo text bleeding all over place without totally removing it?

    How to have dynamic image as CSS background?

    How to get the current year using css?

    How to show only a portion of an image just by using the img tag?

    How do I organize imports in Compass/Blueprint?

    How do I select an element in the dom with an attribute of ct:value?

    How to style my HTML form using CSS

    MaterializeCSS - Mobile Collapse menu not showing when clicked

    How do i change the styling of a nodes CSS through javascript(d3)

    How to fold/unfold a DIV like on this website

    How to include display:block in css code that includes pseudo element 'before'

    how to set two div's height equal with css

    Woocommerce CSS - How do I address Payment Methods, so I can tweak/CSS it

    How to make a number of breaks in CSS? [closed]

    How to display items side by side until window width then in next row

    How style selected option with CSS without styling all the other options?

    How to autoprefix css files generated by less, in Webstorm?