Difference between revisions of "List OnItemClick"
From John Freier
(Created page with 'How to call a click action on the item that is clicked. I have not tryed this yet. ListView lv = getListView(); lv.setOnItemClickListener(new OnItemClickListener() { p…') |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
How to call a click action on the item that is clicked. | How to call a click action on the item that is clicked. | ||
− | I | + | The only problem I had with this method, was calling outside methods. Didn't try |
+ | to hard. | ||
− | |||
+ | ListView lv = getListView(); | ||
+ | |||
lv.setOnItemClickListener(new OnItemClickListener() | lv.setOnItemClickListener(new OnItemClickListener() | ||
{ | { |
Latest revision as of 08:18, 11 February 2011
How to call a click action on the item that is clicked.
The only problem I had with this method, was calling outside methods. Didn't try to hard.
ListView lv = getListView(); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // When clicked, show a toast with the TextView text Toast.makeText(getApplicationContext(), ((TextView) view).getText(), Toast.LENGTH_SHORT).show(); } });