How can I add multiple elements (like title, date, details) as a single item of the list?
This the part of the code for a notes app where I add the title of the task into a list. I want to add more 2 more EditText
fields in the dialogView
and put them all as a single list item and style them in xml
. I tried making another list and put them there but it is displayed like this: [title, date, details] and I don't know how to separate them.
addButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
View dialogView = LayoutInflater.from(MainActivity.this).inflate(R.layout.dialog_view, null);
final EditText edtTaskTitle = dialogView.findViewById(R.id.edt_new_task);
new AlertDialog.Builder(MainActivity.this)
.setTitle("Enter your task")
.setView(dialogView)
.setPositiveButton("Save", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
edtTaskTitle.add(edtTaskTitle.getText().toString());
adapter.notifyDataSetChanged();
}
})
.show();
}
});