Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 17th, 2012  |  syntax: None  |  size: 0.67 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Calling methods on objects in a ListView
  2. @Override
  3. public void onItemClick(AdapterView<?> arg0, View v, int arg2, long arg3) {
  4.     //Code
  5. }
  6.        
  7. @Override
  8. public void onItemClick(AdapterView<?> arg0, View v, int arg2, long arg3) {
  9.     //Arg2 is the position in the list so...
  10.             OfferObject offer = (OfferObject) arg0.getItemAtPosition(arg2);
  11.             //Go to town...
  12. }
  13.        
  14. yourList.setOnItemClickListener(new AdapterView.OnItemClickListener(){
  15.     @Override
  16.     public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
  17.             long arg3) {
  18.         OfferObject offer = (OfferObject) arg0.getItemAtPosition(arg2);
  19.         //Same idea here...
  20.     }
  21.  
  22. });