In a lot of my previous apps, especially my games, I've had to work quite a bit with images. But most of the time these were images that I'd created, and which I could simply drop into a resources directory associated with the app and access easily. I did very early run into out of memory issues, which seem to be very common. I overcame these by scaling down my images. At first I tried to reduce the file size, but what really mattered was the number of pixels, not the file size.
Anyway, for my newest app I'm including a customizable photo gallery, so that within the app the user can add photos which they've either taken with the camera or downloaded onto their SD card, the G1's equivalent of a hard drive. This has turned out to be a royal pain in the ass, primarily because I've found it a chore to emulate the SD card and use with the the emulator in Eclipse. Actually, I found some decent resources for actually creating the virtual card...the Android SDK comes with a "make SD card" command-line tool. But I'll be damned if I could figure out how to create a directory structure on the disk image. None of the tools I had would let me mount the image, and I couldn't find any resources describing how to create a directory structure from the command line. I found a site where someone talked about how to do it in a Mac environment, but try as I might to figure it out for my Windows environment, it was turning out to be more trouble than it was worth. I could push images to the emulated card, but they would show up as broken links in my emulator's gallery, and my app couldn't access them.
So I ended up just coding and testing the gallery function on my hardware phone, which is much slower and troublesome than coding in the emulator, but hey, it worked. Now I've got a portion of my app where a user can create a custom gallery from the images on their SD card, adding, removing, and setting a profile pic if they want.
I'd be interested to know about the experiences of any Android devs who have worked with this aspect of development. It's been one of the more unpleasant things I've tried to build, but at least I've got it working.
I also ran into the good ol' out of memory errors, but was able to effectively deal with them. At least so far. I haven't really load tested the app with gobs of photos. I'm hoping it won't crash, even with dozens of photos, but we'll see.
Oh, and this app better do well. My sales have been sucking pretty hard recently, even though my last couple of apps are sitting with 5 star ratings.
Monday, May 18, 2009
Subscribe to:
Post Comments (Atom)
1 comment:
Can you please share in the way that you cleared the out of memory issues regarding with your application....
Post a Comment