title: Android custom view not showing
body: <p>I am working on an Android version of Gomoku. I am quite new to Java in general and even more so to Android. I am following a book called "Hello Android" where the author teaches the basics through making a game of Sudoku. I am following it loosely, leaving out features not needed for my Gomoku. However, a new view is made when New Game is pressed and although the book continues on as if it should be working, what should be drawn is not showing for me at all. Here is the code that deals with the stuff:</p>
  
  <p>Mainactivity.java:</p>
  
  <pre><code>private void startGame() {
      Log.d(TAG, "Clicked New Game");
      Intent intent = new Intent(this, Game.class);
      startActivity(intent);
  }
  </code></pre>
  
  <p>Game.java:</p>
  
  <pre><code>public class Game extends Activity {
      private static final String TAG = "Game";
      private int board[] = new int[10 * 10];
      private GameView gameView;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          Log.d(TAG, "Game.onCreate called");
          gameView = new GameView(this);
          gameView.requestFocus();
          Log.d(TAG, "Game.onCreate finished");
      }
  }
  </code></pre>
  
  <p>GameView.java:</p>
  
  <pre><code>public class GameView extends View {
      private static final String TAG = "Game";
      private float width; //Width of one tile
      private float height; //Height of one tile
      private final Game game;
      Paint background = new Paint();
      Paint dark = new Paint();
      Paint light = new Paint();
      Paint hilite = new Paint();
  
      public GameView(Context context) {
          super(context);
          this.game = (Game) context;
          setFocusable(true);
          setFocusableInTouchMode(true);
          Log.d(TAG, "GameView finished");
      }
  
      @Override
      protected void onSizeChanged(int w, int h, int oldw, int oldh) {
          super.onSizeChanged(w, h, oldw, oldh);
          width = w / 10f;
          height = h /10f;
          Log.d(TAG, "onSizeChanged: width " + width + ", height " + height);
      }
  
      @Override
      protected void onDraw(Canvas canvas) {
          //Draw the background
          background.setColor(getResources().getColor(R.color.background));
          canvas.drawRect(0, 0, getWidth(), getHeight(), background);
          //Draw the board
          //Define colors for grid lines
          dark.setColor(getResources().getColor(Color.DKGRAY));
          light.setColor(getResources().getColor(Color.LTGRAY));
          hilite.setColor(getResources().getColor(Color.WHITE));
          for (int i = 0; i &lt; 10; i++) {
              Log.d(TAG, "Drawing...");
              canvas.drawLine(0,  i * height - 1,  getWidth(), i * height - 1, light);
              canvas.drawLine(0,  i * width - 1,  getHeight(), i * width - 1, light);
              canvas.drawLine(0,  i * height,  getWidth(), i * height, hilite);
              canvas.drawLine(0,  i * width,  getHeight(), i * width, hilite);
              canvas.drawLine(0,  i * height + 1,  getWidth(), i * height + 1, dark);
              canvas.drawLine(0,  i * width + 1,  getHeight(), i * width + 1, dark);
          }
  
      }
  }
  </code></pre>
  
  <p>I have tried comparing the author's code to mine and except where I am not implementing features he is the codes seem to be matching.
  However, the Log.d(TAG, "onSizeChanged: width " + width + ", height " + height); does not appear in LogCat so I assume this function is simply never called and I do not understand why.</p>