Skip to content

Instantly share code, notes, and snippets.

@notdrone
Created February 15, 2015 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notdrone/8f8fa1cc6df1427de51a to your computer and use it in GitHub Desktop.
Save notdrone/8f8fa1cc6df1427de51a to your computer and use it in GitHub Desktop.
list clicks and toast
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String text = (String) listView.getItemAtPosition(position);
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(getActivity(), text, duration);
toast.show();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment