Hello i am writing application i which i am adding button dynamically on image at some point x and y on screen. When button is clicked image part below that button needs to be zoom. But it's not zooming. Please let me know the mistake i am doing ..Thanks
btnTag.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event) {
int action = event.getAction();
shaderPaint = new Paint();
zoompos = new PointF(0,0);
Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.img);
shader = new BitmapShader(mBitmap, TileMode.CLAMP, TileMode.CLAMP);
shaderPaint.setShader(shader);
canvas= new Canvas(mBitmap);
zoompos.x = event.getX();
zoompos.y = event.getY();
matrix=new Matrix();
switch (action) {
case MotionEvent.ACTION_DOWN:
matrix.reset();
matrix.postScale(2f, 2f, zoompos.x, zoompos.y);
shaderPaint.getShader().setLocalMatrix(matrix);
canvas.drawCircle(zoompos.x, zoompos.y, 100, shaderPaint);
img.setImageMatrix(matrix);
img.setImageBitmap(mBitmap);
case MotionEvent.ACTION_MOVE:
zooming = true;
btnTag.invalidate();
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
zooming = false;
btnTag.invalidate();
break;
default:
break;
}
return true; }
});