If you only want to play the animated gif once, stop calling invalidate()
once you pass the duration.
if (movieStart == 0) {
movieStart = (int) now;
}
if (mMovie != null) {
int relTime = (int) (now - moviestart);
if (relTime > mMovie.duration()) {
relTime = mMovie.duration();
}
mMovie.setTime(relTime);
mMovie.draw(canvas,
getWidth() / 2 - mMovie.width() / 2,
getHeight() / 2 - mMovie.height() / 2);
if (relTime < mMovie.duration()) {
invalidate();
}
}