replace your handler like this
animationDrawable.start();
long totalDuration = 0;
for(int i = 0; i< animation.getNumberOfFrames();i++){
totalDuration += animation.getDuration(i);
}
Handler mHandler = new Handler();
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
Drawable temp = animationDrawable.getCurrent();
imageview.setImageBitmap(setDrawble(temp));
}
}, totalDuration);
public Bitmap setDrawble(Drawable temp) {
Bitmap bm = Bitmap.createBitmap(temp.getIntrinsicWidth(), temp.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bm);
temp.setBounds(0, 0, bm.getWidth(), bm.getHeight());
temp.draw(canvas);
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setColor(Color.CYAN);
paint.setTextSize((int)(temp.getIntrinsicHeight()*0.3));// Text Color
paint.setStrokeWidth(12); // Text Size
canvas.drawText("Testing...", bm.getWidth() / 2, bm.getHeight() / 2,
paint);//change x and y position where you want in the image
return bm;
}