I\'ve made a simple app in android with list View,In that i want to make a toast when select an item,i have tried as below but its not working..
my code is as below:
HashMap selectedValue = (HashMap) (lv.getItemAtPosition(position));
ArrayList list = new ArrayList(selectedValue.keySet());
Toast.makeText(getApplicationContext(), selectedValue.get("txt"), Toast.LENGTH_LONG).show();
That hashmap has got keys which are present in that list
. That list is actually the from
array which you have given. Just give the corresponding key to display the corresponding text.
Its working. :)