retrieving image via HTTP and Display in a popup...

5 messages - 1382 views

hello there... now that the problem with the dynamic list is solved...heres a nother one...

i want to display a simple png wich is stored on a http server...the image is a static google map

I read the tutorial how to display dynamic pictures...this is the result... :)

i use this code to retrive the image

public void loadMyImage(String lat, String lon) {
        GoogleMaps gmap = new GoogleMaps();
        try {
            myImage = gmap.retrieveStaticImage(240, 320, lat, lon, 8, "png32");
            System.out.println("size "+myImage.getWidth());
        } catch (Exception e)
        {
            System.out.println(e);
        }

        dispatchUpdateEvent("myImage");

    }

gmap.retrieveStaticImage returns an lcdui image...so far so good...

size prints the image size...its only for "debug" ;)

in my form i call the popup with this code:

dp.loadMyImage(lat_value,lon_value);
Kuix.showPopupBox("map.xml", dp);

in the dp -->getUserDefinedValue method i return the Image


        if (ITEM_map.equals(property)) {
            return myImage;
        }

XML looks like this:

<popupBox style="align:fill-center;layout:borderlayout">
    <text id="TEXT" text="MAP" />
    <picture>
    <_image>${myImage}</_image>
    </picture>
    <popupBoxFirstMenuItem onAction="">OK</popupBoxFirstMenuItem>
</popupBox>

but i cant see any image...iknow its in there... ;)

- the emu shows the HTTP connection...

- the dp works correct so far...it replaces any other string...

 

it think the error is in the xml...?!

 

any suggestions?

or is there a way to get an image via http with <picture src="link"/>?

 

Thanks

 

 

When the XML is parsed and the parser encounters the ${myImage} tag, it tries to find a property with the name myImage from the DataProvider bind to the popupbox widget. It calls the dp's getUserDefinedValue with the parameter property set to myImage. Now in your implementation you are comparing the property to ITEM_map instead of the "myImage" string, as it should be, so in essence, you're never returning the myImage instance.

THX for your reply Tuukka,

ITEM_map is a String="myImage" ...i forgot to post this...sorry

also i modified "dispatchUpdateEvent("myImage");" to "dispatchUpdateEvent(ITEM_map);"

 

sorry for this...any other ideas?

i solved the problem...i changed the png format to png32 in gmaps image retriever and now it works... :)

Please can you just post some code about you googleMap class; just to let us (me) know how to retrive a google map image from my mobile phone.

Thanks!