I have an image with different frame to be displayed, like the following:

As you can see that image has three frames, the full heart, half heart and empty space.
Now i need to only one frame of the three. I’m just wondering if there is a method to do that using a single gif in android sdk.
For example in several language there is a method like:
canvas.drawImage(xpos,ypos,xwidth,xheight,gifx,gify,gifwidth,gifheight)
where gifx,gify,gifwidth,gifheight are the coordinates and size of the selected frame.
Ok i answer myself, i just found a solution.
In order to draw a multiframe image the following method can be used:
Where:
Another way (that i didn’t tested) could be using BitmapRegionDecoder first of all a new instance of the object must be created using BitmapRegionDecoder.newInstance(…)
and then the selected region of bitmap to be shown could be obtained with the method:
Where rect is the selected region to be shown. For more info on BitmapRegionDecoder:
http://developer.android.com/reference/android/graphics/BitmapRegionDecoder.html