Codenameone ClassCastException-java.lang.String不能强制转换为com.codename1.ui.Image

Codenameone ClassCastException-java.lang.String不能强制转换为com.codename1.ui.Image,codenameone,Codenameone,我正在使用一个JSON字符串,其中包含一个图像对象和其他对象。由此,我创建了一个PropertyBusinessObject,它具有以下特性 public final Property<EncodedImage, Profile> profilePic = new Property<>("profilePic", EncodedImage.class); 我将数据填充到Property business对象中,如下所示: profile.getPropertyIndex

我正在使用一个JSON字符串,其中包含一个图像对象和其他对象。由此,我创建了一个PropertyBusinessObject,它具有以下特性

public final Property<EncodedImage, Profile> profilePic = new Property<>("profilePic", EncodedImage.class);
我将数据填充到Property business对象中,如下所示:

profile.getPropertyIndex().populateFromMap((Map) profileObject);
当我尝试使用以下代码在表单上显示图像时

ScaleImageLabel profilePic = new ScaleImageLabel(profile.getProfilePic()) {
        @Override
        protected Dimension calcPreferredSize() {
            Dimension dimension = super.calcPreferredSize(); 
            dimension.setHeight(Math.min(dimension.getHeight(), Display.getInstance().convertToPixels(40)));
            return dimension;
        }
    };
    profilePic.setBackgroundType(Style.BACKGROUND_IMAGE_SCALED_FILL);
    container.add(BorderLayout.NORTH, profilePic);
我得到一个ClassCastException

异常:java.lang.ClassCastException-无法将java.lang.String转换为com.codename1.ui.Image


有谁能帮我解决这个问题,或者建议使用JSON字符串的另一种方法吗?

populateFromMap目前不支持Base64图像,我将添加它作为一个选项,因为这个用例是有意义的。星期五更新时应该在那里。

图像的格式是什么?base64?图像是base64谢谢Shai。非常感谢。同时,你能告诉我如何才能达到同样的效果吗?你可以浏览地图,用Base64解码的图像替换字符串数据。无论哪种方式,它都将在2天内到达,因此可能不需要解决方法
ScaleImageLabel profilePic = new ScaleImageLabel(profile.getProfilePic()) {
        @Override
        protected Dimension calcPreferredSize() {
            Dimension dimension = super.calcPreferredSize(); 
            dimension.setHeight(Math.min(dimension.getHeight(), Display.getInstance().convertToPixels(40)));
            return dimension;
        }
    };
    profilePic.setBackgroundType(Style.BACKGROUND_IMAGE_SCALED_FILL);
    container.add(BorderLayout.NORTH, profilePic);