** Emulator 不显示 Multichoice item("Google","Apple","Ms","Samsumg","Nokia").... 它不执行 setmultiitemsselected 函数谁能帮我找出解决方案?**
***My Program***
public class DialogActivity extends Activity {
CharSequence[] items = {"Google","Apple","Ms","Samsumg","Nokia"};
boolean[] itemcheck = new boolean[items.length];
public void onClick(View v) {
showDialog(0);
}
@Override
protected Dialog onCreateDialog(int id) {
Dialog d = null;
switch (id) {
case 0:
AlertDialog.Builder ab = new AlertDialog.Builder(this);
ab.setIcon(R.drawable.fb);
ab.setTitle("Facebook Dialog");
ab.setMessage("Successfully Logged");
ab.setPositiveButton("OK",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(getApplicationContext(), "OK Clicked", Toast.LENGTH_LONG).show();}
});
ab.setMultiChoiceItems(items, itemcheck,
new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which, boolean isChecked) {
Toast.makeText(getBaseContext(), items[which] + (isChecked? "Checked" :"Unchecked"), Toast.LENGTH_SHORT).show();
}
});
d = ab.create();
}
return d;
} }
***Xml File***