After some modification in my code, i got my output. Here is a code which i used.
public class FrameView extends View{
Bitmap bitmap = null;
public FrameView(Context context) {
super(context);
this.context = context;
}
public FrameView(Context context, AttributeSet attrs) {
super(context, attrs);
bitmap = Bitmap.createBitmap(this.screenWidth, this.screenHeight,
Bitmap.Config.ARGB_8888);
}
public FrameView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
this.context = context;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (isTouchGestures) {
invalidate();
mImgDrawables.get(0).draw(canvas);
canvas.drawBitmap(bitmap, 0, 0, null);
}
}
//this function is invoked from my activity which is using this view
public void setFrame(int frame) {
bitmap = BitmapFactory.decodeStream(getResources().openRawResource(
frame));
bitmap = Bitmap.createScaledBitmap(bitmap, this.screenWidth,
this.screenHeight, true);
}
}