---------- Forwarded message ---------- From: vani reddy <vani.reddy.bl...@gmail.com> Date: Fri, Nov 4, 2011 at 1:14 PM Subject: customized date picker To: android-developers@googlegroups.com
Hi friends, I have implemented custom date picker:I am setting the day, month and date. I have set the dayscount to be 90. When it crosses Dec31st 2011 it shows Jan 1st 2011, but it should jan1st 2012.I am setting it in the adapter. Here is the adapter class. private class DayArrayAdapter extends AbstractWheelTextAdapter { // Count of days to be shown private final int daysCount = 20; int index_item =0; int day = 0; // Calendar Calendar calendar; /** * Constructor */ protected DayArrayAdapter(Context context, Calendar calendar) { super(context, R.layout.time2_day, NO_RESOURCE); this.calendar = calendar; setItemTextResource(R.id.time2_monthday); } public int getItemId(int arg0) { return arg0; } public View getItem(int index, View cachedView, ViewGroup parent) { this.index_item=index; day = index; Calendar newCalendar = (Calendar) calendar.clone(); newCalendar.roll(Calendar.DAY_OF_YEAR, day); View view = super.getItem(index, cachedView, parent); weekday = (TextView) view.findViewById(R.id.time2_weekday); if (day == 0) { weekday.setText(""); } else { DateFormat format = new SimpleDateFormat("EEE"); weekday.setText(format.format( newCalendar.getTime())); } monthday = (TextView) view.findViewById(R.id.time2_monthday); if (day == 0) { monthday.setText("Today"); monthday.setTextColor(0xFF0000F0); } else { DateFormat format = new SimpleDateFormat("MMM d"); monthday.setText(format.format(newCalendar.getTime())); monthday.setTextColor(0xFF111111); } return view; } public int getItemsCount() { return daysCount + 1; } protected CharSequence getItemText(int index) { return ""; } } Please reply.. -- Regards, Vani Reddy -- Regards, Vani Reddy -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en