External Picture Problem

2 messages - 467 views

Hi all,

I'm loading an external content with JSON; a text and an image. It works fine in J2ME, but when i trying to use this wonderful framework to display the content, i can only see the text, but not the image.

What am i doing wrong? Could someone help me please?

Thank you in advance.


Java:

public class JKNewsFrame implements Frame {

    protected Screen screen;
    private String description;
    private Picture picture;

    public JKNewsFrame(String description, Image image) {
        this.description = description;
        this.picture = new Picture().setImage(image);
    }

    ...

    public void onAdded() {       
        screen = Kuix.loadScreen("news.xml", null);
        ((TextArea) s.getWidget("text")).setText(description);
        ((Picture) s.getWidget("image")).add(picture);
        s.setCurrent();
    }


XML:

<?xml version="1.0" encoding="UTF-8"?>
<screen title="News">
    <scrollPane style="layout:inlinelayout(false,fill); align:center">
        <textarea id="ta"></textarea>
        <picture id="image"></picture>
    </scrollPane>
    ...
</screen>

Hi all,

Finally, i found the solution:

 

Java:

public class JKNewsFrame implements Frame {

    protected Screen screen;
    private String description;
    private Image image;

    public JKNewsFrame(String description, Image image) {
        this.description = description;
        this.image = image;
    }

    ...

    public void onAdded() {       
        screen = Kuix.loadScreen("news.xml", null);
        ((TextArea) s.getWidget("text")).setText(description);
        ((Picture) s.getWidget("image")).setImage(image);
        s.setCurrent();
    }