B4A Library HtmlImageView

Hi all.

Here's something i've been working on recently and decided to share.
It's not a library or a code module but i thought it best posted in this forum anyway.

HtmlImageView is a little piece of javascript that will turn a basic HTML element such as a DIV into a pannable and zoomable image viewer.

The demo code shows off it's various features.

The demo starts with a 'simple example' - an image is loaded and zoomed to a level where it fits the device screen.
A double touch on the image will zoom in a level and a single touch will drag the image around the screen.
I've added some buttons to the HTML to enable you to zoom in, zoom out, zoom to 100% size and zoom to fit the image to the device screen.

Rotate your device though and the previous image position and zoom level are lost - the activity simply reloads as on FirstLoad.

Hit the menu key and choose the 'advanced example' to see a better demo...
The advanced example loads with a shot of Stonehenge (a Google Static maps image), all controls work as they did on the simple example.
Pan or zoom the image and rotate your device - the previous image position and zoom level are restored when the activity is re-created.
I've added a Spinner to the advanced example to enable you to choose from 6 available images.

I've documented the javascript up to a point but not fully so if you want any help customising it just post in this thread and i'll try to help.

Unfortunately there's no chance of pinch to zoom - the native WebView doesn't expose multi-touch events to the javscript engine.
Actually i think that's changed with Honeycomb but for earlier Android versions multi-touch is a no no.

Martin.
 

Attachments

  • HtmlImageView-v1.0.zip
    214.8 KB · Views: 697
Last edited:

GioBarque

New Member
Licensed User
Longtime User
Compiling Error

I'm new to Basic4Android. I was trying to compile your file but I keep getting this error:
Compiling code. Error
Error parsing program.
Error description: Unknown type: jsinterface
Are you missing a library reference?
Occurred on line: 18
Dim WebInterface As JSInterface

:BangHead: Would you please let me know what I'm doing wrong?
 

philgoodgood

Member
Licensed User
Longtime User
hi

@warwound


good job! opens up new possibilities for WebVie

thanks for the sharing ... something lovely ... merci :Sign0188:

works fine for me :)
 
Last edited:

peacemaker

Expert
Licensed User
Longtime User
Is it possible now to see this sample when the lib is not published ?

UPDATE: aha, new lib has similar methods...
UPDATE2: but anyway does not work with the image parameter to .HTM
 
Last edited:
Top