Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to change the time in the second timepicker dialog in the same activity?
    primarykey
    data
    text
    <p>Hi am using two time pickers in the same activity.my requirement is first timepicker will show current time and the second one will show the (current hour +1) but my problem is second one doesnot shows the (current hour +1) it's also displays current time. here is my code</p> <pre><code> if(v.equals(stimeimage)) { stime=true; myYear = c.get(Calendar.YEAR); myMonth = c.get(Calendar.MONTH); myDay = c.get(Calendar.DAY_OF_MONTH); showDialog(DATE_DIALOG_ID); } if(v.equals(etimeimage)) { etime=true; myYear = c.get(Calendar.YEAR); myMonth = c.get(Calendar.MONTH); myDay = c.get(Calendar.DAY_OF_MONTH); showDialog(DATE_DIALOG_ID); } private DatePickerDialog.OnDateSetListener myDateSetListener = new DatePickerDialog.OnDateSetListener(){ public void onDateSet(DatePicker view, int year,int monthOfYear, int dayOfMonth) { if(monthOfYear+1&lt;10) datetext = String.valueOf(year) + "-0"+ String.valueOf(monthOfYear+1) + "-"+ String.valueOf(dayOfMonth); else datetext = String.valueOf(year) + "-"+ String.valueOf(monthOfYear+1) + "-"+ String.valueOf(dayOfMonth); Log.e("datetext",datetext); myHour = c.get(Calendar.HOUR_OF_DAY); if(etime) myHour = c.get(Calendar.HOUR_OF_DAY)+1; Log.e("mhour",""+myHour); myMinute = c.get(Calendar.MINUTE); showDialog(TIME_DIALOG_ID); } }; protected Dialog onCreateDialog(int id) { AlertDialog myDialog = null; switch(id){ case DATE_DIALOG_ID:{ myDialog= new DatePickerDialog(this,myDateSetListener,myYear, myMonth, myDay); break; } case TIME_DIALOG_ID:{ myDialog= new TimePickerDialog(this,myTimeSetListener,myHour, myMinute, false); break; } } return myDialog; } </code></pre> <p>when i pressed the second timepicker in the log it shows the (currenthour+1) but it displays current hour..Please help me what the solution..</p> <p>i googled a lot and didn't find any solution..</p> <p>Thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload