Android datepicker get date and time
<p>I am using datepicker for reserving a table in a restaurant</p>

<p>I have to use two date pickers, one to get date and one to get time</p>

<p>but its not user friendly
i want to use both of them in the same time </p>

<pre><code>public class MainActivity extends AppCompatActivity {

@RequiresApi(api = Build.VERSION_CODES.N)
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    final Calendar c = Calendar.getInstance();
    final int year = c.get(Calendar.YEAR);
    final int month = c.get(Calendar.MONTH);
    final int day = c.get(Calendar.DAY_OF_MONTH);
    final int hour = c.get(Calendar.HOUR_OF_DAY);
    final int minute1 = c.get(Calendar.MINUTE);
    final Calendar v = Calendar.getInstance();
    final int year2 = v.get(Calendar.YEAR);
    final int month2 = v.get(Calendar.MONTH);
    final int day2 = v.get(Calendar.DAY_OF_MONTH);
    final int hour2 = v.get(Calendar.HOUR_OF_DAY);
    final int minute2 = v.get(Calendar.MINUTE);

    final String date;
    final EditText rt1 = (EditText) findViewById(R.id.f1);
    final EditText et1 = (EditText) findViewById(R.id.e1);
    et1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            DatePickerDialog datepick = new DatePickerDialog(MainActivity.this, new DatePickerDialog.OnDateSetListener() {
                @Override
                public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {

                }
            } ,year,month,day);
            datepick.setTitle("select date");
            datepick.show();
        }
    rt1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            TimePickerDialog timepick = new TimePickerDialog(MainActivity.this, new TimePickerDialog.OnTimeSetListener() {


                @Override
                public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                    rt1.setText(hourOfDay + ":" + minute);


                }
            }, hour, minute1, true
            );
            timepick.setTitle("select time");
            timepick.show();


        }
    });

}}
</code></pre>