Android - Show Local Images in WebView

Android - Show Local Images in WebView

By : user2949045
Date : November 16 2020, 06:23 AM
wish of those help Try creating a web pages in your assets directory and creating HTML pages that display the images. Then call a web page using this:
code :
loadDataWithBaseUrl("content://<your contentProvider>/blacksmoke.html", ...);
<!DOCTYPE html>
<!-- Perhaps some JQuery mobile for more functionality and control over which images get displayed and why etc -->
     <div><img src="image/blacksmoke1.jpg"></div>

Share : facebook icon twitter icon
Best way to get images out of SQLite DB and show them in WebView (Android)

Best way to get images out of SQLite DB and show them in WebView (Android)

By : Marios Patrikidis
Date : March 29 2020, 07:55 AM
hop of those help? If the images are very small, just have them base64 encoded within the html page you have saved in the SQLite databasse.
code :
<img src="data:image/png;base64,<BASE64 IMG STRING>" />
Unknown Chromium Error -6 when loading local images in Android Webview

Unknown Chromium Error -6 when loading local images in Android Webview

By : Yaniv Eliyahu
Date : March 29 2020, 07:55 AM
this will help Turns out this error was caused by having images that are larger than 1500px in width. After scaling them down, the error disappears. Must be a problem with the Android webview, I guess.
Show local images inside WebView windows phone 8.1

Show local images inside WebView windows phone 8.1

By : user3091432
Date : March 29 2020, 07:55 AM
Does that help You don't need to put ms-appx:/// before the image name in the source of the html image.
If you have the image in the same folder of the html, the code would be like this:
Online images in local Webview page in Android

Online images in local Webview page in Android

By : The G
Date : March 29 2020, 07:55 AM
Any of those help I have a webview showing a local html page resource in a string like this: , Add these two lines in your code.
code :
Android WebView - Open Local Images

Android WebView - Open Local Images

By : Vhilly Santiago
Date : March 29 2020, 07:55 AM
like below fixes the issue For simplicity purpose, I will make the question short ,
How do I do this for local images?
code :

    <h1>Login Form</h1>
    <img src="download.jpg" width="200px" onClick="Foo.SomeMethod('bla-bla')"></img>
public class MainActivity: Activity
    class Foo : Java.Lang.Object // do not need Java.Lang.IRunnable 
        Context context;

        public Foo(Context context)
            this.context = context;

        [Export] // !!! do not work without Export
        [JavascriptInterface] // This is also needed in API 17+
        public void SomeMethod(string param)
            Toast.MakeText(context, "This is a Toast from C#!" + param, ToastLength.Short).Show();

    protected override void OnCreate(Bundle bundle)


        WebView view = FindViewById<WebView>(Resource.Id.web);
        view.Settings.JavaScriptEnabled = true;
        view.AddJavascriptInterface(new Foo(this), "Foo");
Related Posts Related Posts :
  • The type org.openqa.selenium.firefox.FirefoxDriver is not accessible
  • Limitations (drawbacks) of java programming language?
  • Error: ')' expected Error: illegal start of expression
  • TableRowSorter use LookAndFeel of TableHeader, but own Comparator
  • Difference between @GeneratedValue and @GenericGenerator
  • Design Scenario: Smartphone class and will have derived classes like IPhone,AndroidPhone,WindowsMobilePhone can be even
  • Java date parsing without separators?
  • how to map an array of custom type from postgres to java using hibernate
  • Why hibernate always call "update" statement after using "select" statement in MySQL?
  • An interview topic: What can go wrong with this code?
  • How do I regex remove whitespace and newlines from a text, except for when they are in a json's string?
  • How to turn off Preferences > Compiles > User External Build?
  • how to convert arraylist to string array with all items in double quote
  • PMD+Maven+JAVA Error:: Can't find resource rulesets/comments.xml. Make sure the resource is a valid file or URL or is on
  • How to extend AbstractScheduledService.Scheduler
  • Primefaces tabview: set Active Index after some counting
  • Need help in Regex to exclude splitting string within "
  • Get header from HttpUrlConnection object
  • encoding xlsx as base64 and send it as an attachment
  • How to acess HttpServletRequest in Jaas login module in Tomcat
  • How to implement a basic pointer
  • Java Swing Exit Icon?
  • Why onNext has no effect
  • IntelliJ Idea 2018.2 no option for importing gradle project
  • Remove a negative element from an array w/o array.copy
  • Could this prevent overflow in Java?
  • In Java Swing, can I receive Caret events in real time?
  • I need help not using brute force when using JFrames and DrawWindows
  • How do I refactor ArrayList<MyClass> into MyClassLIst?
  • My program keeps saying that the method cannot be resolved
  • BubbleSort -my code returns random addresses
  • JavaFX components inside HTML?
  • Character in Java game not responding
  • Working around access denied in a FileWalking Tree in Java7
  • How to avoid if/else when using multple suppliers?
  • How to pass object from table cell editor to Table Model?
  • Paypal Sandbox payment state pending
  • sejda-console.bat passing parameters with spaces
  • Multiple Consumers Spring Kafka
  • Bitbucket pipeline: environmental variables in build.gradle file not recognized
  • Java static enum method to return a default enum value
  • What is the complexity of empty for loop?
  • Group randomly List of Lists as N subsets with K elements in each
  • How to set texture on a shape drawn by glDrawArrays()?
  • How to make a jlabel resizable according to the window
  • Java Mathematical Expression Syntax
  • assigning values to characters in java
  • Method overriding and Inheritance in java
  • given a set of lists/groups with a series of number, find matching numbers
  • Connection to HID USB device (keyboard and mouse) in android
  • Inject HttpServletRequest in CDI SessionScoped bean
  • Pool game in java - ball collision algorithm
  • Focus ScrollView to selected position programmatically - Android
  • Is it hibernate bug?
  • Glib memory allocation error
  • Android Proguard - step by step
  • Setting the pivot point of a JPanel to its center
  • java check time is greater time
  • how to save a screenshot (matlab)
  • Anti-aliasing filled shapes in libgdx
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org