android - Calendar in Listview -
i want calendar in listview. have taken gridview inside listview not able populate different months .without using time square lib want achieve this. android scrollable calendar full year
public class listviewcalendaradapter extends baseadapter { string [] result; context context; private static layoutinflater inflater=null; public listviewcalendaradapter(selectdateactivity selectdateactivity, string[] numberlist) { // todo auto-generated constructor stub context=selectdateactivity; result=numberlist; inflater = ( layoutinflater )context. getsystemservice(context.layout_inflater_service); } @override public int getcount() { // todo auto-generated method stub return result.length; } @override public object getitem(int position) { // todo auto-generated method stub return position; } @override public long getitemid(int position) { // todo auto-generated method stub return position; } public class holder { gridview gridview; textview textviewmonth, textviewexceptdate; } @override public view getview(final int position, view convertview, viewgroup parent) { // todo auto-generated method stub holder holder=new holder(); view rowview; rowview = inflater.inflate(r.layout.listview_select_calendar, null); holder.gridview=(gridview) rowview.findviewbyid(r.id.gridview_calendar); holder.textviewmonth=(textview)rowview.findviewbyid(r.id.month); // holder.textviewexceptdate=(textview)rowview.findviewbyid(r.id.exceptdate); holder.textviewmonth.settext(result[position]); calendar _calendar = calendar.getinstance(); int month = _calendar.get(calendar.month) + 1; int year = _calendar.get(calendar.year); holder.gridview.setadapter(new gridviewcalendaradapter(context,r.id.textviewnumber,_calendar)); rowview.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub toast.maketext(context, "you clicked " +result[position], toast.length_long).show(); } }); return rowview; } } public static string[] monthlist = {"july 2016", "august 2016", "september 2016"}; calling listview--> listviewcalendar = (customlistview) findviewbyid(r.id.listview_calendar); listviewcalendar.setadapter(new listviewcalendaradapter(this, monthlist));
Comments
Post a Comment