开发者

j2me NullPointerException adding image to a vector

private Vector menuOptions;

void addOption(String imagefilename) {
    try {
        Image i = Image.createImage(imagefilename);
        menuOptions.addElement((Object)i);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

And I'm getting: java.lang.NullPointerException at GraphicMenu.addOption(GraphicMenu.java:开发者_运维知识库31) //addElement line

Can I add a Inmutable images to a Vector Object?


Have you initialized the vector?

Vector menuOptions = new Vector();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜