title: Android Simple Canvas Program
body: <p>Okay, I'm trying to create a simple app that will draw a shape (I'm trying a circle) wherever you click.  I have tried a couple times, but haven't gotten anything to work yet.  I would think that somebody has done this before, so if theres a link to a tutorial/source code of a similar project, that would help. What I think I'm stuck on is how to use threads, and how to update the onDraw() function.  If you haven't figured it out already, I'm pretty new to Android and even java.</p>
  
  <p>Currently I have: </p>
  
  <p>--Main.java--</p>
  
  <pre><code>    public class MAIN extends Activity {
          CustomDrawableView mCustomDrawableView; 
          /** Called when the activity is first created. */
          @Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
  
              mCustomDrawableView = new CustomDrawableView(this);        
              setContentView(mCustomDrawableView);
  
          }
  
  //Implement a thread here that would somehow update the view everytime.  Everytime I try this though it doesn't work
      }
  </code></pre>
  
  <p>--CustomDrawableView.java--</p>
  
  <pre><code>public class CustomDrawableView extends View {
      //private ShapeDrawable mDrawable;
      int x=0;
      int y=0;
  
      public CustomDrawableView(Context context) {
          super(context);
  
      }
  
      protected void onDraw(Canvas canvas) {
          Paint mPaint = new Paint();
          mPaint.setColor(0xffff0000);
          canvas.drawCircle(x, y, 5, mPaint);
      }
  }
  </code></pre>