• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps HTML use in android apps

Droid101

Lurker
Hello everybody I am in need of some help with developing apps based on HTML. I built the app in eclipse and then place the html page that I want to be displayed when the app is opened in "Test App\assets\html". Now how do I get the app to display that html file?

To be clear I want the html file that is in the "Test App\assets\html" folder to be the content of the app (what is displayed).

Thanks for the help, I know it is probably a stupid question but I am VERY new to development. Your time is much appreciated.
 
Step 1. Create a webview in the XML of the activity. Suppose the 'id' of the webview is 'webView1'
Step 2. Instantiate an object of WebView class in the java file and bind it with the view. Then call the 'loadUrl()' method.

Sample code :
public class ViewWeb extends Activity{
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.webview);
WebView wv;
wv =(WebView) findViewById(R.id.webView1);
wv.loadUrl("file:///android_asset/fileName.html");​
}​
}​
 
Back
Top Bottom