0

I have one html file which consists of images in it. When I try to load that html file using webview, the html file loads but images didn't.

Main Activity File Code(activity_about)

 webviewAbout=(WebView)findViewById(R.id.webview_about);

 webviewAbout.loadUrl("file:///android_asset/about.html"); 

activity_about.xml code

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
     android:orientation="vertical"
    tools:context=".MainActivity"
    tools:ignore="NestedWeights,UselessParent" >
  <!-- main layout -->

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="0.10"
        android:orientation="horizontal">  <!-- First layout -->

        <ImageButton
                android:id="@+id/ibtn_about_back"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:scaleType="center"
                android:layout_weight="0.2"

                android:src="@drawable/backiconlogo" />

            <ImageView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="0.8"
                android:scaleType="fitXY"
                android:src="@drawable/paniclogo" />

        </LinearLayout>                                     

        <RelativeLayout 
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:orientation="horizontal"
            android:layout_weight="0.80"
            android:background="@color/TechWhite">
                    <WebView 
                        android:id="@+id/webview_about"
                        android:layout_height="fill_parent"
                        android:layout_width="fill_parent"/>


        </RelativeLayout>

        <LinearLayout                                   
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:orientation="horizontal"
            android:layout_weight="0.10"
            android:background="@color/TechWhite">
        <Button
               android:id="@+id/btn_exit_about" 
               android:layout_width="0dp"
               android:layout_height="match_parent"
               android:layout_weight="0.5"
               android:text="Exit"
               android:padding="10dp"
               android:layout_marginLeft="150dp"
               android:textSize="15sp"
               android:layout_gravity="center"
               android:background="@color/Blackish_Yellow"
               android:textColor="@color/Brownnish"/>

        </LinearLayout>                         
</LinearLayout> 

about.html file

<html>
    <head>      <h2 align="center">About</h2>
            <h2 align="center">Panic App</h2>
        <title>
        </title>
    </head>
    <body bgcolor="#f8f8ec">
        <h1 align="center"><img src="E:\PANIC APP\assets\images\Paniclogo.png"/></h1>
        <p align="center">Version 1.0</p>
        <p align="center"></br>The “Panic App” is a emergency kind Application that it will help you out to get out of any “Emergency” situation by sending you help at the place you are.</p>
        <p align="center">It will also guide you that what “Primary” measure you should take during such Panic situation.</p>       

    </body>
</html>
Jay Pokar
  • 61
  • 1
  • 7

1 Answers1

0

Many times it occurs just due to nomenclature. ensure that name of image file and name of image used are the same( check for uppercase and lowercase characters also).

Deepak jha
  • 298
  • 5
  • 19