Skip to content

Instantly share code, notes, and snippets.

Last active April 4, 2017 09:12
What would you like to do?
listView actions
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Button deleteMealButton = (Button) findViewById(;
if (listView.getCheckedItemCount() == 0) {
} else {
listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
Meal meal = adapter.getItem(position);
final AlertDialog.Builder builder = getAlertBuilder(view, mealContract, meal);;
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment