1.直接上代码,直接写
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(context);
alertBuilder.setSingleChoiceItems(arr, 0, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
//Toast.makeText(context, items[i], Toast.LENGTH_SHORT).show();
String name = content.get(i).getName();
tv_save.setText(name);
alertDialog2.dismiss();
}
});
alertDialog2 = alertBuilder.create();
alertDialog2.show();