public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.Statisticslayout, container, false);

            mlistview  = view.FindViewById <ListView>(Resource.Id.listViewBarchart);
            datepicker = view.FindViewById <DatePicker>(Resource.Id.datePicker1);
            tvtotalkw  = view.FindViewById <TextView>(Resource.Id.textViewTotalKW);

            adapter           = new MyBarChartAdapter(this.Context);
            mlistview.Adapter = adapter;



            if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop)
            {
                int daySpinnerId = Resources.GetIdentifier("day", "id", "android");
                if (daySpinnerId != 0)
                {
                    View daySpinner = datepicker.FindViewById(daySpinnerId);
                    if (daySpinner != null)
                    {
                        daySpinner.Visibility = ViewStates.Gone;
                    }
                }
            }
            else
            {
                Java.Lang.Reflect.Field[] f = datepicker.Class.GetDeclaredFields();
                foreach (Java.Lang.Reflect.Field field in f)
                {
                    if (field.Name.Equals("mDaySpinner") || field.Name.Equals("mDayPicker"))
                    {
                        field.Accessible = true;
                        object dayPicker = null;
                        try
                        {
                            dayPicker = field.Get(datepicker);
                        }
                        catch (Java.Lang.IllegalAccessException e)
                        {
                            e.PrintStackTrace();
                        }
                        ((View)dayPicker).Visibility = ViewStates.Gone;
                    }
                }
            }
            Calendar calendar = Calendar.GetInstance(Locale.Default);

            datepicker.Init(calendar.Get(CalendarField.Year), calendar.Get(CalendarField.Month), calendar.Get(CalendarField.DayOfMonth), this);
            calendar.Set(CalendarField.Date, calendar.GetActualMinimum(CalendarField.Date));
            startTime = calendar.TimeInMillis;
            calendar.Set(CalendarField.Date, calendar.GetActualMaximum(CalendarField.Date));
            endTime = calendar.TimeInMillis;
            //FeedFromDb(startTime,endTime);
            return(view);
        }
            public override Dialog OnCreateDialog(Bundle savedInstanceState)
            {
                var dialog = new DatePickerDialog(Activity, Resource.Style.CustomDatePickerDialogTheme, this,
                                                  mParent.mYear, mParent.mMonth, 1);

                DatePicker datePicker = dialog.DatePicker;

                // Limit range.
                Calendar c = mParent.GetCalendar();

                datePicker.MinDate = c.TimeInMillis;
                c.Set(CalendarField.Year, mParent.mYear + CC_EXP_YEARS_COUNT - 1);
                datePicker.MaxDate = c.TimeInMillis;

                // Remove day.
                datePicker.FindViewById(Resources.GetIdentifier("day", "id", "android"))
                .Visibility = ViewStates.Gone;
                return(dialog);
            }
        private void hideDay()
        {
            DatePicker datePicker = this.DatePicker;

            int daySpinnerId = Resources.System.GetIdentifier("day", "id", "android");

            if (daySpinnerId != 0)
            {
                View daySpinner = datePicker.FindViewById(daySpinnerId);
                if (daySpinner != null)
                {
                    daySpinner.Visibility = ViewStates.Gone;
                }
            }

            DateTime maxdate = DateTime.Today.AddYears(10);

            datePicker.MaxDate = new Java.Util.Date(maxdate.Year - 1900, maxdate.Month - 1, maxdate.Day).Time;

            DateTime minDate = DateTime.Today;

            datePicker.MinDate = new Java.Util.Date(minDate.Year - 1900, minDate.Month - 1, minDate.Day).Time;
        }