0

I want to create a ToDoList application for android. For Entering ToDoItem i am using alert , This is working properly. But now i want to show a datepicker also in alert. But it is not adding both view

(EditText and DatePicker) in alert. MyCoding is final AlertDialog.Builder al = new AlertDialog.Builder(obj); al.setMessage("ToDo Item"); // Set an EditText view to get user input final EditText input = new EditText(obj); final DatePicker dat= new DatePicker(obj); al.setView(input); al.setView(dat); al.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { toDoItems.add(0,input.getText().toString()); aa.notifyDataSetChanged(); } }); al.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.dismiss(); } }); al.show(); 

Please suggest me what to do ?

2

2 Answers 2

1

AlertDialog displays one, two or three views. But you want to display more than three views, so try using CustomDialog instead.

Sign up to request clarification or add additional context in comments.

Comments

0

For that you need to create a custom dialog where you can put any widget in it. Please Look at the following links:

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.