0

To simulate an animation I decode a sequence of frame next to another and update it on a Bitmap at a fixed rate. The problem is everytime the BitmapFactory.decodeFile function get call it allocate new File and FileInputStream objects, this leads to the GC being called very frequently.

So is there a way to effectively decode file in this scenario for Android. Note that caching Bitmap is useless here 'cause the frames loop continuously one after another.

2
  • As long as you use files you have to create a new inputstream for every file. You cannot blame bitmap factory for that. Commented Oct 21, 2016 at 10:05
  • So there's no way to reuse the InputStream I guest? Or can you suggest an efficient way to decode bitmap from file repetitively? Commented Oct 21, 2016 at 10:38

1 Answer 1

0

You'd better convert the bunch of image files into AGIF format and play it.

Check this post. https://stackoverflow.com/a/20277649/4518710

Sign up to request clarification or add additional context in comments.

1 Comment

Hello! GIF doesn't work for me because I need to draw these Bitmap with OpenGL. What I'm after here is to create animated stickers and overlay them on camera feed.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.