ImageViewer crashes in android

31 views
Skip to first unread message

Guilherme Motta

unread,
Dec 5, 2013, 5:34:57 AM12/5/13
to codenameone...@googlegroups.com
        Display.getInstance().openImageGallery(new ActionListener() {
            InputStream is;
            public void actionPerformed(ActionEvent evt) {
                try {
                    path=evt.getSource().toString();
                    is=FileSystemStorage.getInstance().openInputStream(path);
                    image=Image.createImage(is);
                    findIvImagem().setImage(image);
                } catch (IOException ex) {
                    Dialog.show("Error:",ex.getMessage(),"OK", null);
                }               
            }
        });

When I selects the image, the image should appear in the ImageViewer but the app back to my first form...

Why happens this problem?

Chen Fishbein

unread,
Dec 5, 2013, 8:29:17 AM12/5/13
to codenameone...@googlegroups.com
it is failing on memory, because the image is huge.
instead of opening it with the stream do this:

image=Image.createImage(path); //the createImage with path is memory clever.

Guilherme Motta

unread,
Dec 5, 2013, 8:45:17 AM12/5/13
to codenameone...@googlegroups.com
Ok Chen I fix this problem, but don't work ...

Chen Fishbein

unread,
Dec 5, 2013, 9:17:04 AM12/5/13
to codenameone...@googlegroups.com
what is happening now? do you get an exception? do you have a stacktrace?

Guilherme Motta

unread,
Dec 5, 2013, 9:18:38 AM12/5/13
to codenameone...@googlegroups.com
No, only the same problem, in simulator runs fine...

Chen Fishbein

unread,
Dec 5, 2013, 9:47:03 AM12/5/13
to codenameone...@googlegroups.com
from where are you calling Display.getInstance().openImageGallery?
notice the openImageGallery will try to return to the Form it was invoked from, so maybe your screens flow is wrong, first make sure you are back to the invoking Form and navigate to the viewer

Reply all
Reply to author
Forward
0 new messages