0

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();
            }
        });
AskNilesh
  • 67,701
  • 16
  • 123
  • 163
  • create custom layout for that `EditText` view like https://stackoverflow.com/a/46742001/4545142 – Harin Kaklotar Dec 07 '17 at 13:30
  • Possible duplicate of [Android - Executing a custom listview in a custom dialog properly](https://stackoverflow.com/questions/17914714/android-executing-a-custom-listview-in-a-custom-dialog-properly) – Pavneet_Singh Dec 07 '17 at 13:47

0 Answers0