I have a AlertDialog
of Multichoice Items.I want to have an EditText
beside each item. How do i achieve this?
third_card.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final AlertDialog.Builder mBuilder = new AlertDialog.Builder(EnterRecordActivity.this);
mBuilder.setTitle("Select Contributor");
mBuilder.setMultiChoiceItems(listMembers, checkedMembers, new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int position, boolean isChecked) {
}
});
mDialog = mBuilder.create();
mDialog.show();
}
});
This is what i achieved till now with the following code
This is what i want. An edit text with each multichoice item
Create custom dialog like this:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
LayoutInflater inflater = (this).getLayoutInflater();
//Your layout file name is custom_check_with_edt
View dialogView = inflater.inflate(R.layout.custom_check_with_edt, null);
//get Id from custom view
EditText edtNote = dialogView.findViewById(R.id.edt_notes);
builder.setView(dialogView);
builder.setPositiveButton("Ok", (dialog, which) -> {
//YOUR LOGIC
}
dialog.dismiss();
});
builder.setNegativeButton("Cancel", (dialog, which) -> dialog.dismiss());
builder.setCancelable(true);
Dialog dialog = builder.create();
dialog.show();