Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Load html file from assets folder in a WebView

    • 0
    • 2
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 9.54k
    Comment on it

    By doing following steps you can load the HTML file from the assets folder inside your application:-
    1) Copy that HTML file inside your assets folder.
    2) Define a WebView in your layout, like this

    1. <WebView
    2. android:id="@+id/webview"
    3. android:layout_width="match_parent"
    4. android:layout_height="match_parent"
    5. />

    3) Initialize webview inside the activity or fragment and then load the html like this

    1. webview = (WebView) findViewById(R.id.webview);
    2. webview.loadUrl("file:///android_asset/test.html");

    Cheers :)

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: