Loading of large textures

I am trying to write a gallery app in cocos2d, where a user views photos in his sd card’s memory and then does things to the photo. I’ve managed to read the file names and load the photo, however it immediately crashes because the app ran out of memory.

Since I don’t need such a high resolution, it is possible to resize the photo as I load it in somehow with subsampling? I’ve actually found a solution, but it’s outside cocos2d’s framework: http://developer.android.com/training/displaying-bitmaps/load-bitmap.html

It’s not immediately clear to me how to call the functionality with jni. Perhaps someone has a better idea?

Hi,
How do you read file names and load files?
Regards,
Mariusz

Use this: http://javatechig.com/android/listing-all-sdcard-filenames-with-extensions-in-android
and this: http://stnguyen.com/cocos2d-x/call-java-functions-from-cpp.html

Seems that all camera apps have some ability to control the resolution of their output images. Looks like this wasn’t much of a problem after all!