1

I want to display around 150 frames in 5 sec ( 30fps) on Android imageview .All frames are stored in SdCard from there i loaded into Bitmap Arraylist . For ex iToD Arraylist of Bitmap mBitmap (Bitmap Object)

for (int i=0;i<100;i++){
    mBitmap = iToD.get( i );    
    mImageView.setImageBitmap(mBitmap);
}

But its not able to render all frames i want it should able to render all frames .Giving me some kind of sliding effect.

Abhishek
  • 181
  • 2
  • 12

2 Answers2

0

You have to use a handler.

final int index = 0;
final Handler handler = new Handler();
Runnable runnable = new Runnable() {

    public void run() {

        mImageView.setImageBitmap(iToD.get( index++ ));
        if(index != iToD.size()) {
        handler.post(this);

    }

};
handler.post(runnable);
Sherif elKhatib
  • 45,786
  • 16
  • 89
  • 106
0
                Hi,

                Try this

                    AnimationDrawable animDrawable = new AnimationDrawable();


               // Create as many drawable as needed and add it to the AnimationDrawable.

                for (int i=0;i<100;i++){
                    mBitmap = iToD.get( i );    
                   Drawable frame = new BitmapDrawable(b1);
                    animDrawable.addFrame(frame, 250);
                }

        //Then create an ImageView and set the background as the animationDrawable.
        mImageView.setBackgroundDrawable(animDrawable);

    Handler startAnimation = new Handler() {
      public void handleMessage(Message msg) {
        super.handleMessage(msg);
        animDrawable.start();
      }
    };


    //and call the handler as

    Message msg = new Message();
    startAnimation.sendMessage(msg);

For More information refer this link,
http://smartandroidians.blogspot.in/2010/02/animation-through-bitmap.html
Jatin
  • 1,650
  • 3
  • 17
  • 32