title: Android draw a dot in a canvas based on gps coordinates
body: <p>Is it possible to do this? Im no good at painting stuff out got a very basic "Dot class" which draws a circle based on x and y but the cavas is in a FrameLayout the size of about half my emulated 3,7 in screen. Needless to say ive only got about 150 on the y and something like 200 on the x (guess its pixels). Is there a way to scale the canvas to paint coordinates? </p>
  
  <p>Preferably my lociation gets drawn in the center and other locations in my viewing "range" gets painted based on my location.</p>
  
  <p>So im basically asking if there is a way to scale a canvas to coordinates and allow me to specify that scale. so if Im at 32.345 and -212.988765 thats the center and I can see other locations within say a 10km range or something like that.</p>
  
  <p>My current Dot class:</p>
  
  <pre><code>    public class Dot extends View{
      private final float x;
      private final float y;
      private final int r = 5;
      private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
  
      public Dot(Context context, float x, float y) {
          super(context);
          mPaint.setColor(0xFFFF0000);
          this.x = x;
          this.y = y;
      }
  
      @Override
      protected void onDraw(Canvas canvas) {
          super.onDraw(canvas);
  
          canvas.drawCircle(x, y, r, mPaint);
      }
  
  
  }
  </code></pre>
  
  <p>The reporting of gps coordinates is working and painting is working but only if its within the range of the canvas right now.</p>
  
  <p>Just to make it clear, everything in my app is working and the correct coordinates are being passed around, the last part I need is a visual representation and I have no idea on how to get the canvas to act like a map.</p>
  
  <p><em>Edit</em> Another problem im having is the drawing, when the position updates it sure does redraw but it appends a new circle leaving the old one still there. How do I refresh it completely so the circle "moves" instead of appending a new one? I tried calling invalidate on the view but that didnt do anything.</p>