Open image with uppercase extension JPG, PNG using Display.getInstance().execute(path)

52 views
Skip to first unread message

Ivan

unread,
Apr 13, 2017, 9:22:08 AM4/13/17
to CodenameOne Discussions
Hi guys,

on Android: when I try to open image with uppercase extension: JPG, PNG in associated application using Display.getInstance().execute(path) the device allways tries to open it as PDF.
With lowercase extension works everything ok.

Is this CN1 bug or Android problem?

(I'm using workaround renaming the file to lowercase extension currently, but it's not very comfortable)

thanks

Ivan

If you are experiencing an issue please mention the full platform your issue applies to:
IDE: Eclipse
Desktop OS: Ubuntu 16.04
Simulator
Device: Xiaomi Redmi Note 4

Steve Hannah

unread,
Apr 13, 2017, 12:34:28 PM4/13/17
to codenameone...@googlegroups.com
I don't see anything explicitly setting this in our code.  My guess is that android treats ".PNG" differently than ".png", and you have previously chosen your PDF program to open files with .PNG.  Check out the settings for your PDF application in settings to see if this is the case.  Directions would be similar to this:

Best regards

Steve

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/cf15222d-f4c3-4907-be9b-087012611ff2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Steve Hannah
Software Developer
Codename One

Ivan Ilavsky

unread,
Apr 13, 2017, 1:27:14 PM4/13/17
to codenameone...@googlegroups.com
Hi Steve,

All my PDF apps have the "Clear defaults" option disabled because no defaults are set.
I don't have associated app neither with JPG nor PNG.
When I click such a file in file manager (or gallery, or any other app) I'm getting application selection to select in which application it should open (PDF app is not present in the selection).
The same I have in CN1 application with lowercase extensions.

But uppercase JPG or PNG are always handled like PDF, I tested both extensions on more devices and the behavior is the same.

Best regards

Ivan Ilavsky

On Thu, Apr 13, 2017 at 6:34 PM, Steve Hannah <steve....@codenameone.com> wrote:
I don't see anything explicitly setting this in our code.  My guess is that android treats ".PNG" differently than ".png", and you have previously chosen your PDF program to open files with .PNG.  Check out the settings for your PDF application in settings to see if this is the case.  Directions would be similar to this:

Best regards

Steve
On Thu, Apr 13, 2017 at 6:22 AM, Ivan <ivan.i...@gmail.com> wrote:
Hi guys,

on Android: when I try to open image with uppercase extension: JPG, PNG in associated application using Display.getInstance().execute(path) the device allways tries to open it as PDF.
With lowercase extension works everything ok.

Is this CN1 bug or Android problem?

(I'm using workaround renaming the file to lowercase extension currently, but it's not very comfortable)

thanks

Ivan

If you are experiencing an issue please mention the full platform your issue applies to:
IDE: Eclipse
Desktop OS: Ubuntu 16.04
Simulator
Device: Xiaomi Redmi Note 4

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsubscr...@googlegroups.com.



--
Steve Hannah
Software Developer
Codename One

--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/Dq8hhyNwqPg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discussions+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Shai Almog

unread,
Apr 14, 2017, 1:53:26 AM4/14/17
to CodenameOne Discussions, ivan.i...@tamebytes.sk
Hi,
Is the image under the app home path?
How does the full URL to the file look?
I think it might reach an edge case in getMimeType(String) and Android might not recognize some types correctly

Ivan Ilavsky

unread,
Apr 17, 2017, 11:13:16 AM4/17/17
to codenameone...@googlegroups.com
Hi Shai,

the image is in Android/data/<packageName> directory.
The full URL is: file:///storage/emulated/0/Android/data/sk.easysoft.maintplan/IMG_20170417_09254.JPG

--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/Dq8hhyNwqPg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discussions+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.

For more options, visit https://groups.google.com/d/optout.

Shai Almog

unread,
Apr 18, 2017, 1:25:31 AM4/18/17
to CodenameOne Discussions, ivan.i...@tamebytes.sk
Hi,
if you copy it over to the app home directory is the behavior different?
Reply all
Reply to author
Forward
0 new messages