asmal Posted April 23, 2015 Share Posted April 23, 2015 Bonjour,Je veux supprimer tous les éléments d'un Hushmap , voici une partie du code @[member=override] protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_historique); // associate the button from interface to code initInterface(); addButtonClickListner(); HistFile = (HistoryFileManager) getIntent().getParcelableExtra( MainActivity.PAR_KEY); // Adding menuItems to ListView // android.R.layout.activity_list_item; final ListAdapter adapter = new SimpleAdapter(this, HistFile.menuItems, R.layout.list_application, new String[] { HistFile.KEY_NOM_APPLICATION, HistFile.KEY_DATE_CREATION }, new int[] { R.id.textViewNameApplication, R.id.textViewDateCreation }); listView1.setAdapter(adapter); btn_Supprimer.setOnClickListener(new OnClickListener() { @[member=override] public void onClick(View v) { AlertDialog.Builder builder = new AlertDialog.Builder(v .getContext()); DialogInterface.OnClickListener listenerYes = new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { //Qu'est ce que je doit faire là Toast.makeText(getApplicationContext(), "Suppression réussie", Toast.LENGTH_SHORT) .show(); } }; DialogInterface.OnClickListener listenerNo = new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User cancelled the dialog } }; builder.setMessage(R.string.supprimerAllApplications) .setPositiveButton(R.string.yes, listenerYes) .setNegativeButton(R.string.no, listenerNo); AlertDialog d = builder.create(); d.setTitle("Supprimer historique"); d.show(); } }); } j'ai utilisé la méthode clear , remove mais ça marche pas Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.