Android - Event Handling
About
Views object handle events.
Articles Related
Example
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String message = (String) parent.getItemAtPosition(position);
Context context = getContext();
CharSequence text = message;
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
});
with:
- a toast
- when an item on the list is clicked