在数组中获取选中项目的值,代码:
final String items[] = {"Blue","Green","Orange"}; final AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Money Maker"); alert.setIcon(R.drawable.ic_launcher); alert.setMultiChoiceItems(items, checkedItems, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { String value = items.toString(); Toast.makeText(getApplication(), value, Toast.LENGTH_LONG).show(); } }); alert.show();
怎么获取值并且在toast中显示?谢谢。
相关分类