handle gif images in android
<p>In my android application i am using Movie to display gif but the issue i am facing is if i am receiving images with extension .gif with only one frame of image it is displaying blank screen.<br>
Please let me know the better way to display gif in android.<br>
The code i am using is  </p>

<pre><code>public MYGIFView(Context context, InputStream is, int i, int j,int screenWidth,int screenHeight) {
    super(context);

    //is=context.getResources().openRawResource(red);
    movie=Movie.decodeStream(is);
    xcoordinate = i;
    ycoordinate = j;
    viewWidth = screenWidth;
    viewHeight = screenHeight;


    setLayoutParams(new LayoutParams(viewWidth,viewHeight));

}

@Override
protected void onDraw(Canvas canvas) {
    if(movie != null) {
        long now = android.os.SystemClock.uptimeMillis();
        int dur = Math.max(movie.duration(), 1); // is it really animated?
        int pos = (int)(now % dur);
        movie.setTime(pos);
        movie.draw(canvas,xcoordinate, ycoordinate);
    }
</code></pre>
