-
-
Save jezinka/9ba6d78861ea750303b18f1beac02a07 to your computer and use it in GitHub Desktop.
onChildClick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { | |
@Override | |
public boolean onChildClick(ExpandableListView parent, final View v, final int groupPosition, final int childPosition, final long id) { | |
AlertDialog.Builder childContextMenuBuilder = new AlertDialog.Builder(v.getContext()); | |
childContextMenuBuilder.setItems(R.array.dinner_child_actions, new DialogInterface.OnClickListener() { | |
public void onClick(DialogInterface dialog, int which) { | |
Date date = dinnerAdapter.getGroup(groupPosition); | |
switch (which) { | |
case 0: | |
AlertDialog.Builder addBuilder = addNewDinnerBuilder(v, date); | |
addBuilder.show(); | |
break; | |
case 1: | |
dinnerContract.deleteDinner(id, dbHelper); | |
dinnerAdapter.updateResults(dinnerContract.getDinners(dbHelper)); | |
break; | |
case 2: | |
Dinner dinner = dinnerAdapter.getChild(groupPosition, childPosition); | |
AlertDialog.Builder editBuilder = addNewDinnerBuilder(v, date, dinner); | |
editBuilder.show(); | |
break; | |
} | |
} | |
}); | |
childContextMenuBuilder.show(); | |
return true; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment