Zoom effect on Android SurfaceView

I am developing a Car Race Game. I am able to move, stop, accelerate. But i want that when i press screen then car(bitmap of car image) should look like, it had jumped on its place.I am using surfaceviewto draw view

I do not want to use 3D openGL. Any help is much appreciated

  • In Android - How can I register only long clicks using a ClickableSpan
  • Create blurry transparent background effect
  • LocalBroadcastManager vs Context.registerReceiver(), Context.sendBroadcast(Intent), and Context.unregisterReceiver() are they same?
  • Add Google Play Services to Eclipse project
  • How to control ActionBar split programmatically?
  • How do I use adb grant or adb revoke?
  • Why does ContentResolver.requestSync not trigger a sync?
  • Is there any way to use Roboguice and ActionbarSherlock in one project?
  • How to set theme to ProgressDialog?
  • Android Studio with Google Play Services
  • Why is touchstart event after click?
  • Properly log out a user from android app
  • One Solution collect form web for “Zoom effect on Android SurfaceView”

    finally i used.On touch event, i create a bigger bitmap and draw it on same place. So it will give zoom effect

    Bitmap bitmapToZoom;  // Create a Bitmap
    // Now zoom it 
    bitmapToZoom=Bitmap.createScaledBitmap(bitmapToZoom, bitmapToZoom.getWidth()+30,bitmapToZoom.getHeight()+30, null); 
    //now draw it again
    canvas.drawBitmap(bitmapToZoom, 0,0,null);
    

    So now finally, Zooming actor on touch code will be like this. Class Name ZoomonTouc.java

    import android.content.Context;
    import android.graphics.Bitmap;
    import android.graphics.BitmapFactory;
    import android.graphics.Canvas;
    import android.graphics.RectF;
    import android.view.MotionEvent;
    import android.view.SurfaceView;
    
    public class ZoomonTouc extends SurfaceView {
    public Bitmap mMyChracter;
    
    public ZoomonTouc(Context context) {
        super(context);
        mMyChracter = BitmapFactory.decodeResource(context.getResources(),
                R.drawable.ic_launcher);
        setWillNotDraw(false);
    }
    
    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawBitmap(mMyChracter, mMyChracter.getWidth()/2, mMyChracter.getHeight()/2, null);
        invalidate();
    }
    
    @Override
    public boolean onTouchEvent(MotionEvent event) {
        RectF rectF = new RectF(mMyChracter.getWidth()/2, mMyChracter.getHeight()/2, mMyChracter.getWidth() + 100,
                mMyChracter.getHeight() + 100);
        if (rectF.contains(event.getX(), event.getY())) {
            mMyChracter = Bitmap.createScaledBitmap(mMyChracter,
                    mMyChracter.getWidth() + 10, mMyChracter.getHeight() + 10,
                    false);
        }
        return true;
    }
    

    }

    To test it properly create one activity and set above surface to activity background

    setContentView(new ZoomonTouc(this));
    
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.