I have a GridView in which every item must have an ID other than its position in the grid so that I can pass that id using Intents to another activity?
How can I specify this extra parameter and how can I access it inside onItemClick method?
Edit:
int catID = cu.getInt(0);
myView.setTag((Object) catID);
That’s how I use setTag method.
Intent categoryActivity = new Intent(getParent(), CategoryActivity.class);
categoryActivity.putExtra("itemId", (Integer) v.getTag());
startChildActivity("CategoryActivity", categoryActivity);
And this how I use getTag.
I’m wondering if I’m doing it correctly?!
You can use
View.setTag()andView.getTag()methods for this.