title: How to get row and column value in a grid layout?
body: <p>I have defined a GridView in Android Studio, and I want to get the row and column value of each cell. Basically I am building a Tic Tac Toe kind of app and I want the value of each cell so that I can find if that cell is empty or filled.</p>
  
  <pre><code>int chance = 0;
  int[] pos = new int[9];
  public void click(View view) {
      ImageView counter = (ImageView) view;
      if(chance == 0) {
             counter.setImageResource(R.drawable.yellow);
             chance = 1;
             // Here I want to update the that this particular cell is 
             clicked and it should be updated in pos array.
      }
      else {
             counter.setImageResource(R.drawable.red);
             chance = 0;
             // Similarly here also it should be updated.
      }
  }
  </code></pre>