title: AccelerometerPlayActivity source transform
body: <p>I'd like to transform this activity.</p>
  
  <p>Que 1. one Ball Image -> variety of Ball Image<br>
  Que 2. Rect Collision -> Round Collision</p>
  
  <hr>
  
  <pre><code>        public void resolveCollisionWithBounds() {
              final float xmax = mHorizontalBound;
              final float ymax = mVerticalBound;
              final float x = mPosX;
              final float y = mPosY;
              if (x &gt; xmax) {
                  mPosX = xmax;
              } else if (x &lt; -xmax) {
                  mPosX = -xmax;
              }
              if (y &gt; ymax) {
                  mPosY = ymax;
              } else if (y &lt; -ymax) {
                  mPosY = -ymax;
              }
          }
  </code></pre>
  
  <hr>
  
  <pre><code>    public SimulationView(Context context) {
          super(context);
          mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
          DisplayMetrics metrics = new DisplayMetrics();
          getWindowManager().getDefaultDisplay().getMetrics(metrics);
          mXDpi = metrics.xdpi;
          mYDpi = metrics.ydpi;
          mMetersToPixelsX = mXDpi / 0.0254f;
          mMetersToPixelsY = mYDpi / 0.0254f;
          // rescale the ball so it's about 0.5 cm on screen
          Bitmap ball = BitmapFactory.decodeResource(getResources(), R.drawable.ball);
          final int dstWidth = (int) (sBallDiameter * mMetersToPixelsX + 0.5f);
          final int dstHeight = (int) (sBallDiameter * mMetersToPixelsY + 0.5f);
          mBitmap = Bitmap.createScaledBitmap(ball, dstWidth, dstHeight, true);
          Options opts = new Options();
          opts.inDither = true;
          opts.inPreferredConfig = Bitmap.Config.RGB_565;
          mWood = BitmapFactory.decodeResource(getResources(), R.drawable.wood, opts);        }
  </code></pre>