Dave
Dave

Reputation: 29131

Custom loading graphic for Android - control an animated gif?

I want to create a custom, complicated loading graphic for my Android App (minSDK 8).

If I create a GIF with 100 frames, is there a way in Java/Android to tell it which frame to go to during my 'doProgress()' function?

Is there another or better way to do custom loading graphics?

Upvotes: 2

Views: 4684

Answers (2)

Sujan Shrestha
Sujan Shrestha

Reputation: 419

If you have a gif image, then you can use WebView component to show the gif image. In webview, the image loops itself, we do not need to do extra work.

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1006879

If I create a GIF with 100 frames, is there a way in Java/Android to tell it which frame to go to during my 'doProgress()' function?

Since Android does not do animated GIFs, no.

Is there another or better way to do custom loading graphics?

Option #1: Use a frame animation.

Option #2: Use a RotateAnimation with a single image in an ImageView.

Option #3: Use ViewPropertyAnimator (using NineOldAndroids for the backport) to animate android:rotation with a single image in an ImageView.

There may be other options as well, though those are the three that come to mind.

Upvotes: 2

Related Questions