Handling The Larger Images without "OUT OF MEMORY" Exception

Forum for J2ME mobile games related topics including programming doubts, books and other resources for J2ME game development

Handling The Larger Images without "OUT OF MEMORY" Exception

Postby uvrpavan » Mon Jul 07, 2008 2:43 pm


I am preparing a "all in one" Image viewer which contain all the options like Zoom In/Out and every thing.
I am using "InputStream" by getting the FileConnection Object.The code i am using is

InputStream fis = fc.openInputStream();
img = Image.createImage(fis)

But here i am getting Out of Memory Exception for larger pictures. So, Can u please gimme a Solution for handling Such a big Pictures.....
I have a SonyEriccson Mobile in which even the device explorer also cant handle the pictures which are taken by the Digi Camera with Resolution around
(2000 * 2000).So i want to pepare a viewer which can handle that.....:)

Thanks and Regards
UVR Pavan
Posts: 19
Joined: Sun Feb 11, 2007 8:52 am

Re: Handling The Larger Images without "OUT OF MEMORY" Exception

Postby DevelopmentTeam » Tue Jul 08, 2008 3:51 am

To be simple, it definitely not possible from a JavaME application, as you cannot read a big file into the stream. The problem should have occurred during openInputStream itself. Meanwhile, JavaME doesnt have any speacial function to read a part of the file and even that might not help in few image formats.
User avatar
Site Admin
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India

Return to J2ME Games

Who is online

Users browsing this forum: No registered users and 2 guests