Android: Alert Dialog
<p>Help....I have a problem...Here is the cod...</p>

<pre><code>@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case IDD_COLOR:
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Pick a color");
    ListView listView = new ListView (this);
    builder.setInverseBackgroundForced(true);
    listView.setAdapter(new ArrayAdapter(this, android.R.layout.select_dialog_multichoice, mColors ));

    listView.setOnItemClickListener(new OnItemClickListener() {

          @Override
        public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1,
                int arg2, long arg3) {
            switch (arg2) {
            case 0: 
                if (!((CheckedTextView)arg0.getChildAt(arg2)).isChecked()) 
                {
                    ((CheckedTextView)arg0.getChildAt(arg2)).setChecked(true);
                } else 

                    ((CheckedTextView)arg0.getChildAt(arg2)).setChecked(false);

            break;
            case 1: 
                if (!((CheckedTextView)arg0.getChildAt(arg2)).isChecked()) 
                {
                    ((CheckedTextView)arg0.getChildAt(arg2)).setChecked(true);
                } else 

                    ((CheckedTextView)arg0.getChildAt(arg2)).setChecked(false);

                break;
            case 2: 
                if (!((CheckedTextView)arg0.getChildAt(arg2)).isChecked()) 
                {
                    ((CheckedTextView)arg0.getChildAt(arg2)).setChecked(true);
                } else 

                    ((CheckedTextView)arg0.getChildAt(arg2)).setChecked(false);

                break;
            }

        }
    });
    builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {

        }
    });
    builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {

            }
    });

    builder.setView(listView);
    return builder.create();
default:
return null;
}
</code></pre>

<p>How to cancel what was clicked by pressing Cancel Button ? Because It all the time save what was clicked.</p>
