Java tutorial
//package com.java2s; // it under the terms of the GNU General Public License as published by import android.graphics.Point; public class Main { /** * convert a gridId to a x y point * * @param id from grid TextView indicating which position in the grid it is * @return point equivalent of id parameter */ public static Point convertIDToPoint(int id, int size) { Point point = new Point(); point.x = id % size; point.y = id / size; return point; } }