title: Move an object using accelerometer
body: <p>Hello :) I created a yellow canvas with a ball on it, now i'm trying to move the ball but I don't know how, it's the first time i'm using an accelerometer and it's my first time using canvas and draw.. So can you help me moving it?</p>
  
  <p>Here is my code so far:</p>
  
  <pre><code>     package com.example.theball;
  
  import android.support.v4.widget.DrawerLayout.LayoutParams;
  import android.app.Activity;
  import android.graphics.Bitmap;
  import android.graphics.Bitmap.Config;
  import android.graphics.Canvas;
  import android.graphics.Color;
  import android.graphics.Paint;
  import android.hardware.SensorEvent;
  import android.os.Bundle;
  import android.view.Display;
  import android.widget.ImageView;
  import android.widget.RelativeLayout;
  
  public class MainActivity extends Activity {
  private int c = Color.YELLOW;
  private Canvas g;
  @Override
  public void onCreate(Bundle savedInstanceState) 
  {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.fragment_main);
      draw();
      }
  @SuppressWarnings("deprecation")
  public void draw ()
  {
      Display display = getWindowManager().getDefaultDisplay();
      int width = display.getHeight();
      int height = display.getWidth();
      Bitmap bitmap = Bitmap.createBitmap(width, height, Config.RGB_565);
      g = new Canvas(bitmap);
      g.drawColor(c);
      Paint paint = new Paint();
      paint.setColor(Color.BLACK);
      g.drawCircle(50, 10, 25, paint); 
      ImageView imageView = new ImageView(this);
      imageView.setImageBitmap(bitmap);
      RelativeLayout layout = new RelativeLayout(this);
      RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
      LayoutParams.WRAP_CONTENT);
      params.addRule(RelativeLayout.CENTER_IN_PARENT);
      layout.addView(imageView, params);
      layout.setBackgroundColor(Color.BLACK);
      setContentView(layout);   
  }
  public void onSensorChanged(SensorEvent event)
  {
  
  }
  
  }
  </code></pre>