Dmitry
Dmitry

Reputation: 2887

Reusing Android bitmaps for loading many images

My app needs to display long animation with separate full-screen size images per frame. AnimationDrawable can not be used, as I can not load all images in memory (about 300 images will be around 100 Mb).

So what I'm trying to do is to load image every frame without keeping it in memory. But in order to keep memory usage low, I'm trying to avoid any allocations in my thread loop.

I found that Android SDK v3 has interesting feature in BitmapFactory.Options.inBitmap which tries to decode stream into specified bitmap (if it can).

My question is: Is it possible to reproduce the same feature (BitmapFactory.Options.inBitmap) for SDK v2?

Upvotes: 0

Views: 747

Answers (2)

android developer
android developer

Reputation: 116352

first, you are not talking about the SDK, but about the android version as it is shown to end users (honeycomb ,which is 3.x vs gingerbread and below which is 2.x ).

the real thing to look at is the API number . the feature you are talking about has started from API11 (honeycomb) , so you can't use it on older devices, unless you get android's code and do the same for your app.

here's a tutorial of how to use this cool feature: http://www.youtube.com/watch?v=rsQet4nBVi8

Upvotes: 0

eternalmatt
eternalmatt

Reputation: 3564

Your question is a little misinformed. SDK level 2 corresponds to Android 1.1, and I believe you want to develop for Android 2.0 and above, which is SDK level 5. You should have no problems using that feature which came from SDK level 3.

In general, "Updates to the framework API are designed so that the new API remains compatible with earlier versions of the API."

http://developer.android.com/guide/appendix/api-levels.html

Edit: A feature that was introduced at SDK level 11 (Android 3.0) is not available for phones below 3.0.

Upvotes: 1

Related Questions