3

Is that any way to get the row and column number of the clicked cell in GridView (Android)?

public void onItemClick(AdapterView parent, 
        View v, int position, long id) 
        {   
            int row_no=position/MAX_COL;
            int col_no=position%MAX_COL;
            Toast.makeText(getBaseContext(), 
                    "pic" + (position + 1) + " selected" + "ID" + id, 
                    Toast.LENGTH_SHORT).show();

        }

I'm using this but is there any way to directly get the row, col no

Mahendran
  • 2,719
  • 5
  • 28
  • 50

0 Answers0