Messages by franklinz

2 topics, 7 messages
Kuix technical support » retrieving image via HTTP and Display in a popup...

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

Kuix technical support » retrieving image via HTTP and Display in a popup...

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?

Kuix technical support » retrieving image via HTTP and Display in a popup...

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

 

 

Kuix technical support » simple question - dynamic text list

Works fine...THANK YOU !!!!

Kuix technical support » simple question - dynamic text list

EDIT:  i've read the multi dataprovider tut and think I`ve done a step forward,

Now i get the values in the list :)

but how do i get kuix to draw x list items...?  I believe that the xml is correct...

but where i have to put the function? and how ;)

I tried some loop statements but it doesent worked... :(

Some ideas?

 

thx

my new main class:


public class main extends KuixMIDlet implements Frame {

   // DataProvider mydataProvider = new DataProvider();

    public void initDesktopStyles() {
        Kuix.loadCss("helloworld.css");
    }

    public void initDesktopContent(Desktop desktop) {
        MasterDataProvider masterDataProvider = new MasterDataProvider();

        SlaveADataProvider sld = new SlaveADataProvider("second");
        masterDataProvider.addSlave(sld);
        Screen screen = Kuix.loadScreen("dynamic-display.xml", masterDataProvider);
        screen.setCurrent();
    }

    public boolean onMessage(Object identifier, Object[] arguments) {
       return false;
    }

    public void onAdded() {
    }

    public void onRemoved() {
    }
}

My DataProvider Class #1


public class MasterDataProvider extends DataProvider {

    protected Object getUserDefinedValue(String property) {
        if ("first_one".equals(property)) {
            return "first";
        }
        return super.getUserDefinedValue(property);
    }

}

Second one...


    public class SlaveADataProvider extends DataProvider {

    String name=".";

    public SlaveADataProvider(String name) {

    this.name = name;
    }


   protected Object getUserDefinedValue(String property) {
        if ("second_one".equals(property)) {
            return name;
        }
        return super.getUserDefinedValue(property);
    }


}

And the XML:

<screen style="layout:inlinelayout(false,fill)">
    <list>
    <listitem>${first_one}</listitem>
    <listitem>${second_one}</listitem>
    </list>
    <list>
    <_renderer><![CDATA[
                <listitem>${second_one}</listitem>
            ]]></_renderer>
    </list>
</screen>

 

Kuix technical support » simple question - dynamic text list

Thy for your reply...

 

this realy helps to understand...

But the subProvider has no method "setValue". I`m using kuix 1.1?!

Is it right that this method try`s to search for the tag "foo" in the xml and set its value to "hello"+i ?

This item is added to the mydataprovider and this one is added to the screen when i=4?!

 

 

Kuix technical support » simple question - dynamic text list

Hello there...

first...respect for your hard work...you've done a top...

i searched a while an found some examples for generating dynamic fields / buttons and so on. But none worked....

 

I created this sample code based on the tutorial and some posts...

import org.kalmeo.kuix.core.Kuix;
import org.kalmeo.kuix.core.KuixConstants;
import org.kalmeo.kuix.core.KuixMIDlet;
import org.kalmeo.kuix.core.model.DataProvider;
import org.kalmeo.kuix.widget.Desktop;
import org.kalmeo.kuix.widget.Screen;
import org.kalmeo.kuix.widget.Text;
import org.kalmeo.kuix.widget.TextField;
import org.kalmeo.util.frame.Frame;

public class main extends KuixMIDlet implements Frame {

    DataProvider mydataProvider = new DataProvider();

    public void initDesktopStyles() {
        Kuix.loadCss("helloworld.css");
    }

    public void initDesktopContent(Desktop desktop) {
        Kuix.getFrameHandler().pushFrame(this);
        final Screen screen = Kuix.loadScreen("dynamic-display.xml", mydataProvider);
       
        screen.setTitle("Hello List");

        TextField item = new TextField();
       
        for (int i = 0; i < 5; i++) {
        Text t = new Text ("foo");
        t.setText("HELLO "+i);
        }
        screen.add(item);
        screen.setCurrent();
    }

    public boolean onMessage(Object identifier, Object[] arguments) {
        if ("exit".equals(identifier)) {
            main.getDefault().destroyImpl();
            return false;
        }

        if ("about".equals(identifier)) {
            Kuix.alert("D", KuixConstants.ALERT_OK);
            return false;
        }

        return true;
    }

    public void onAdded() {
    }

    public void onRemoved() {
    }
}

The XML:

<screen title="foobar">
    <container style="layout:borderlayout">
        <scrollPane horizontal="false" showscrollbar="true">
            <scrollpaneScrollbar></scrollpaneScrollbar>
            <scrollpaneContainer style="layout:borderlayout">

            <list>
            <_renderer><![CDATA[
                <textfield>@{foo}</textfield>
            ]]></_renderer>
            </list>

            </scrollpaneContainer>
        </scrollPane>
    </container>
    <screenFirstMenu onAction="exit">Exit</screenFirstMenu>
</screen>

Could someone explain me what i'm doing wrong?!

I only want an output like:

HELLO 1
HELLO 2
HELLO 3
HELLO 4
HELLO 5

thx