Java tutorial
//package com.java2s; import android.view.View; import android.view.ViewGroup; public class Main { public static int[] getViewCellCoords(View v) { int col = ((ViewGroup) v.getParent()).indexOfChild(v); ViewGroup vgRow = (ViewGroup) v.getParent(); int row = ((ViewGroup) vgRow.getParent()).indexOfChild(vgRow); return new int[] { col, row }; } }