title: how to get position of row and column in table view
body: <p>I am a beginner in android. 
  I am trying to get position of current image, the dynamic row and column,but I don't know how to do this.Below is my code,please help me:</p>
  
  <pre><code>MainActivity extends Activity {
  
      int i,j;
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          String[] row = { "ROW1", "ROW2", "Row3"};
          String[] column = { "COLUMN1", "COLUMN2","CO" };
          int rl=row.length; int cl=column.length;
  
          ScrollView sv = new ScrollView(this);
          TableLayout tableLayout = createTableLayout(row, column,rl, cl);
          HorizontalScrollView hsv = new HorizontalScrollView(this);
  
          hsv.addView(tableLayout);
          sv.addView(hsv);
          setContentView(sv);
  
      }
  
      public void makeCellEmpty(TableLayout tableLayout, int rowIndex, int columnIndex) {
          // get row from table with rowIndex
          TableRow tableRow = (TableRow) tableLayout.getChildAt(rowIndex);
  
          // get cell from row with columnIndex
          TextView textView = (TextView)tableRow.getChildAt(columnIndex);
  
          // make it black
          textView.setBackgroundColor(Color.BLACK);
      }
      public void setHeaderTitle(TableLayout tableLayout, int rowIndex, int columnIndex){
  
          // get row from table with rowIndex
          TableRow tableRow = (TableRow) tableLayout.getChildAt(rowIndex);
  
          // get cell from row with columnIndex
          TextView textView = (TextView)tableRow.getChildAt(columnIndex);
  
          textView.setText("Hello");
      }
  
      private TableLayout createTableLayout(String [] rv, String [] cv, final int rowCount, int columnCount) {
          TableLayout.LayoutParams tableLayoutParams = new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
          TableLayout tableLayout = new TableLayout(this);
          tableLayout.setBackgroundResource(R.drawable.bookshelf);
  
          TableRow.LayoutParams tableRowParams = new TableRow.LayoutParams();
          tableRowParams.setMargins(2, 2, 2, 2);
          tableRowParams.weight = 1;
  
          for (i = 0; i &lt; rowCount; i++) {
  
              TableRow tableRow = new TableRow(this);
  
             tableRow.setBackgroundResource(R.drawable.bookshelf);
  
              for (j= 0; j &lt; columnCount; j++) {
  
                  final ImageView imageView = new ImageView(this);
                  imageView.setImageResource(R.drawable.businessman);
  
                  imageView.setOnClickListener(new View.OnClickListener() {
                      @Override
                      public void onClick(View v) {
                          Toast.makeText(getApplicationContext(), "position : " + rowCount, Toast.LENGTH_SHORT).show();
                      }
                  });
  
                  tableRow.addView(imageView, tableRowParams);
  
              }
  
              // 6) add tableRow to tableLayout
              tableLayout.addView(tableRow, tableLayoutParams);
          }
  
          return tableLayout;
      }
  }
  </code></pre>
  
  <p>thanks in advance.</p>