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

Untitled

By: a guest on Apr 28th, 2012  |  syntax: None  |  size: 0.60 KB  |  hits: 24  |  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. onListItemClick returns data from the item at the top of current view
  2. @Override
  3. protected void onListItemClick(ListView l, View v, int position, long id) {
  4.     super.onListItemClick(l, v, position, id);
  5.     // Get the item that was clicked
  6.     TextView tv = (TextView)findViewById(R.id.item_title);
  7.     Toast.makeText(getApplicationContext(), (tv).getText(),
  8.             Toast.LENGTH_SHORT).show();
  9. }
  10.        
  11. A
  12. ----- (Start of Viewable area)
  13. B
  14. C
  15. D
  16. ------(End of viewable area)
  17. E
  18.        
  19. // Call on the child view provided as a parameter, instead of on the ListView
  20. TextView tv = (TextView)v.findViewById(R.id.item_title);