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.
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.
Share Improve this question asked Nov 7, 2013 at 4:08 Proxy_ServerProxy_Server 4012 gold badges7 silver badges18 bronze badges 5- First make a build ( I suggest phonegap ). – Ankit Tyagi Commented Nov 7, 2013 at 4:11
- Tyagi if i copy my project folder in asset folder and using webview concept,it work or not? – Proxy_Server Commented Nov 7, 2013 at 4:32
- Well no idea about webview. But you can make a zip of your project and go to build.phonegap. create an free account and upload your zip file and make a build ( .apk file for android or any other platform). That will easily run on your emulator as well as any android phone. ( NOTE : Make sure your project only have HTML, CSS and Javascript files only ) – Ankit Tyagi Commented Nov 7, 2013 at 4:41
- your html and other file is on server or in local db? – PankajAndroid Commented Nov 7, 2013 at 4:42
- local machine..i am developing project in elipse. – Proxy_Server Commented Nov 7, 2013 at 5:16
2 Answers
Reset to default 4use a WebView view in your layout XML file:
<WebView xmlns:android="http://schemas.android./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.
Did you try the Apache Cordova Project?
Maybe requires some work on setup but I believe that it will work for your case.