Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ma fonction appui long sur ma listview
- mRecetteList.setOnItemLongClickListener(new OnItemLongClickListener() {
- public boolean onItemLongClick(AdapterView parent, View v, int position, long id) {
- ilaposition=position;
- //création d'un boite de dialogue pour confirmer le choix
- new AlertDialog.Builder(EnregRecette.this)
- .setTitle("Confirmation")
- .setMessage("Voulez vous supprimer cet ingredient de la liste")
- .setPositiveButton("OUI", new DialogInterface.OnClickListener()
- {
- public void onClick(DialogInterface dialog, int whichButton)
- {
- aTableauIngredientaff.remove(ilaposition);
- aTableauIngredient.remove(ilaposition);
- mRecetteList = (ListView) findViewById(android.R.id.list);
- final ArrayAdapter adapter2 = new ArrayAdapter(getBaseContext(),
- android.R.layout.simple_list_item_1,aTableauIngredientaff);
- mRecetteList.setAdapter(adapter2);
- }
- })
- .setNegativeButton("NON", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int whichButton) {
- /* User clicked Cancel so do some stuff */
- }
- })
- .show();
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement