Present date setting in android showing one month extra -


I want to set the current date to activity (by default) and configure the user The date by clicking on the date picker, but some devices, which shows an extra for one month, the date picker dialog also shows an additional one month. Can you please make this issue

  public void setCurrentDateOnButton () help to solve {Log.d (enter LogActivityTagNames.SCHEDULE_ACTIVITY, "setCurrentDateOnButton () to") to me; Last calendar c = calendar.getInstance (); Myear = c.get (Calendar. IEER); Mmonth = c.get (calendar .mONTH) +1; Mday = c.get (Calendar DAY_OF_MONTH); String Month = Accelerated Redeemable Format DateTime (mmOnth); String Day = Accelerated Redeemable Format datetime (mday); DateksetText (new StringBuilder () .append (day) .append ( "-") attached (Month) .append ( "-") .append (myear) .append ( "").); }  

...

  private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener () to see {public void onDateSet (DatePicker, integer selectedYear, Integer selectedMonth, int selected) {myear = selected year; Mm = chosen silence; Mday = selectedDay; String Month = Accelerated Redeemable Format DateTime (mmOnth); String Day = Accelerated Redeemable Format datetime (mday); DateksetText (new StringBuilder () attached (day) .append ( "-") attached (Month) .append ( "-") attached (myear) .append ( "") ...); }};  

Remove +1 from this line mmonth = c.get (calendar. Month) +1; is just like

mmonth = c.get (Calendar.MONTH)

  DateksetText (new StringBuilder () .append (day) .append ( "-") attached (Month) .append ( "-") .append (myear) .append ( "").);  

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -