Android How to get position of selected item from gridview without using onclicklistner, using ontouchlistner instead?

Use onItemClickListener to get particular item of a grid view Override public void onItemClick(AdapterView arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub // here arg2 is the position of the grid view item on which you have clicked on } Try it. It works for me.

Use onItemClickListener to get particular item of a grid view. @Override public void onItemClick(AdapterView arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub // here arg2 is the position of the grid view item on which you have clicked on } Try it. It works for me.

I know I can use this onitemclick to get the position but I cant get keydown/keyup with this. – zonemikel Feb 10 at 15:26 why do you want to use onTouchListener? Directly use onItemClickListener for the grid view.

– debarati Feb 10 at 16:59.

I have a gridview, I need to do stuff on motioneven. Action_down and do something for motioneven. Action_up ... using onclicklistener is great but does not give me this needed functionality.

Is there anyway to easily call the gridview and get its selected item in a ontouchlistener? I've been having limited success with making my own implementation. Its hard to get the right x,y because if I call the child it gives me the x and y relative to the child so a button would be 0,0 to 48,48 but it does not tell you the actual location on the screen relative to the gridview or the screen itself.

This is what i've been doing, its partially working so far.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions