title: Using enum in Android Java programming
body: <p>I'm trying to write a game in android and I want to use enum.</p>
  
  <p>This is my enum class:</p>
  
  <pre><code>public enum State {
     INACTIVE(0), ACTIVE(1);
  
    private final int value;
  
    private State(int value){
        this.value = value;
    }
  
    public int getValue() {
        return value;
    }
  }
  </code></pre>
  
  <p>and then I want to use enum in my method and constructor:</p>
  
  <pre><code>public FieldsGame(){
      Board = new char[BOARD_SIZE_VERTICAL][BOARD_SIZE_HORIZONTAL];
      for (int i = 0; i &lt; BOARD_SIZE_VERTICAL; i++) {
          for (int j = 0; j &lt; BOARD_SIZE_HORIZONTAL; j++) {
              Board[i][j] = EMPTY_SPACE;
              BoardState[i][j] = State.INACTIVE.getValue();
          }
      }
  }
  
  public void clearBoard() {
      for (int i = 0; i &lt; BOARD_SIZE_VERTICAL; i++) {
          for (int j = 0; j &lt; BOARD_SIZE_HORIZONTAL; j++) {
              Board[i][j] = EMPTY_SPACE;
              BoardState[i][j] = State.INACTIVE.getValue();
          }
      }
  }
  </code></pre>
  
  <p>When I'm trying to launch my application it sais "Unfortunatelly, <em>application</em> has stopped."
  I'm sure it is because of enum cause when I comment these two lines:</p>
  
  <pre><code>BoardState[i][j] = State.INACTIVE.getValue();
  </code></pre>
  
  <p>where I'm using enum, it works. Can somebody help me, please?</p>