title: Android, help rotating image on touch
body: <p>I am trying to rotate one of the transparent PNGs on this image. The number part is what I want to rotate. I am able to do this, but it is not what I am trying to achieve</p>
  <p><a href="https://i.stack.imgur.com/yLWvH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yLWvH.png" alt="" /></a></p>
  
  <p>I want to rotate the numbers like on a real combination lock. So the user will touch and move their finger in a circle. I looked at less precise image rotation on touch/move events, and they were not sufficient.</p>
  <p>this is currently my code</p>
  <pre><code> public boolean onTouch(View v, MotionEvent event) {
      double r=Math.atan2(event.getX()-lockNumbers.getWidth(), lockNumbers.getHeight()-event.getY());
      int rotation=(int)Math.toDegrees(r);
      switch (event.getAction()) {
          case MotionEvent.ACTION_DOWN:
              break;
          case MotionEvent.ACTION_MOVE:
              x=event.getX();
              y=event.getY();
              updateRotation(rotation);
              break;
          case MotionEvent.ACTION_UP:
              break;
      }//switch       
  
      return true;
  
  }//onTouch
  private void updateRotation(double rot){
      float newRot=new Float(rot);
      Bitmap bitmap=BitmapFactory.decodeResource(getResources(),R.drawable.numbers);
      Matrix matrix=new Matrix();
      matrix.postRotate(newRot,bitmap.getWidth(),bitmap.getHeight());
      if(y&gt;250){
          Bitmap reDrawnBitmap=Bitmap.createBitmap(bitmap,0,0,bitmap.getWidth(),bitmap.getHeight(),matrix,true);
          lockNumbers.setImageBitmap(reDrawnBitmap);
      }
      else{
          Bitmap reDrawnBitmap=Bitmap.createBitmap(bitmap,0,0,bitmap.getWidth(),bitmap.getHeight(),matrix,true);
          lockNumbers.setImageBitmap(reDrawnBitmap);
      }
  }
  </code></pre>
  <p>it also resizes the bitmap when you touch it because of the matrix parameter. This is not the desired effect.</p>
  <p>The user will pretty much be required to go in a circle with their finger.</p>