2

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.

5
  • First make a build ( I suggest phonegap ). 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? 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.com 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 ) Commented Nov 7, 2013 at 4:41
  • your html and other file is on server or in local db? Commented Nov 7, 2013 at 4:42
  • local machine..i am developing project in elipse. Commented Nov 7, 2013 at 5:16

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

8 Comments

Ankxx13 this for only one html page.but in my project total 267 html files and also more than 100 css and javascript files.then what to do now?
@priyashivale Do you want the whole website of yours in your android application ? is that what you want to do ?
no my project is mobile apps.my project correctly work in iphone.for time being i have access my project through browser using localhost.
Ankxx13 is there any possibility. i have copied my project folder in asset folder and run it through webview load url.and give path of main form.but still it not work.
@priyashivale please post your code that you have tried to do so far. cant able to say anything beside seeing your code. hope you understand.
|
0

Did you try the Apache Cordova Project?

Maybe requires some work on setup but I believe that it will work for your case.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.