Galaxy Nexus, drawing a centered circle
<p>I'm trying to draw a circle in the center of the screen of my Galaxy Nexus, more as a learning experience than anything. To do that I'm using this line of code:</p>

<pre><code>canvas.drawCircle(canvas.getWidth()/2, canvas.getHeight()/2, 40, paint);
</code></pre>

<p>The problem is I can only see a quarter of the circle in the bottom right of the screen. I've tried this exact same code on my Galaxy SII and it draws the circle in the middle of the screen. I've checked the value of getwidth and getheight and it reports 640x1052, But on the screen the coordinate of the bottom right pixel is 320 by about 450 (excluding the buttons onscreen). </p>

<p>What is going on? Could part of the app be setting the resolution or something?</p>

<p>I've included my full activity below.</p>

<pre><code>package com.helloworld;


import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

public class ShapeTest extends Activity {
    class RenderView extends View {
        Paint paint;
        public RenderView(Context context) {
            super(context);
            paint = new Paint();
        }
        protected void onDraw(Canvas canvas) {
            Context context = getApplicationContext();

        canvas.drawRGB(255, 255, 255);
        paint.setColor(Color.RED);
        canvas.drawLine(0, 0, this.getWidth()-1, this.getHeight()-1, paint);
        paint.setStyle(Style.STROKE);
        paint.setColor(0xff00ff00);
        canvas.drawCircle(canvas.getWidth()/2, canvas.getHeight()/2, 40, paint);
        paint.setStyle(Style.FILL);
        paint.setColor(0x770000ff);
        canvas.drawRect(100, 100, 200, 200, paint);

    }
}
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(new RenderView(this));
}
</code></pre>

<p>}</p>
