• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps A little problem on Android GridView, HELP !

Weiz07

Lurker
Hey, good evening to all Android experts here :)
I have a little question want to ask for all your help T.T Please answer my question :o
I had learnt Android platform since last week, and now I have a new question on android gridview.
Here is the questions :
1. I have the gridview for android in the apps i created. I am showing it with image adapter, and now I wish to know how to know which image users had click on when i debug my app? :confused: because when users click on different image then there will have different things showing out.
I did a little research and they said try to use OnItemClickListener, but i am still very confuse on how to use it?:confused:

Thanks a lots for your teaching! :willy::thrasher:
 
Google provide a sample application which shows how this works:

Code:
// Set a item click listener, and just Toast the clicked position
g.setOnItemClickListener(new OnItemClickListener() {
     public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
     Toast.makeText(Gallery1.this, "" + position, Toast.LENGTH_SHORT).show();
     }
});
Gallery1.java | Android Developers
 
Back
Top Bottom