as we know, using the Android grid view, we can do the following and get a notification when an element is clicked:
gridview.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { Toast.makeText(PopularCapitActivity.this, "" + position, Toast.LENGTH_SHORT).show(); } });
we also know that if a cell in the grid contains a clickable element, say, a button, then the above will not be fired.
so I currently have a grid view, each cell has its own button, so now when the user clicks on the button, it will have its own action based on the cell in which the button is located, to my question, how can I to access cell position in button handler?
thanks
android android-gridview gridview android-widget
user1697965
source share