Question: I am making an android app in which I have x and y coordinates and i need to find position of the view in grid view. I just want to know is there any function or simple method to find the position. 

```
 skip this line

```

Answer: 
This works for me:

```
yourGridView.pointToPosition(yourX, yourY);

```

pointToPosition(int x, int y) is a functions in the GridView class
When a user click on your gridView you can just use this code:

```
gridview.setOnItemClickListener(new OnItemClickListener() {

public void onItemClick(AdapterView<?> parent, View v, int position, long id) { 

int clickedPosition = position; 

}}

```

clickedPosition is a variable that contains the position of the clicked view starting from the upper-left side of your gridView and starting by 0