i have GridView, populated with images of 6 fruits (from drawable-hdpi). like this: de4e62f8db2c5d5afe016e20eda3d9d6

now on selection, how can i come to know, what fruit the user has selected? since i'm populating my images from drawables-hdpi, so wot would be the identifier, and how to identify selection through it?

Thanks :)

It's tough to advise you when you haven't posted your code.

The simple answer is that when you receive your onItemClick event, you just look at the position (argument 3) that is passed back. That tells you the position inside the GridView (argument 1) that was clicked. You can examine whatever you've put in the View (argument 2).

Again, a lot depends on how you've implemented your GridView, and how you've populated your array adapter. If the above doesn't help, post some code and we'll try to assist you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.