0

I use Parse.com as backend, and I want work with calendarview in order to let the users select a range of dates and store them in parse. Then I will retrieve that information to set it in a differen CalendarView. I am using CalendarListView explained here

Now in the sample they provide I see this method:

@Override
public void onDateRangeSelected(SimpleMonthAdapter.SelectedDays<SimpleMonthAdapter.CalendarDay> selectedDays)
{

    Log.e("Date range selected", selectedDays.getFirst().toString() + " --> " + selectedDays.getLast().toString());
}

So if I want to store that in parse, should I use an Array, how do I store secteddays in parse. There is another library that I was trying to use, here which is similar to the previous and its method to get selected days is:

@Override
    public void alertSelectedFail(FailEven even) {
        Toast.makeText(context, "alertSelectedFail", Toast.LENGTH_SHORT).show();
    }

So As you can see I can get a List of dates from this method, so how do I storage that in Parse? Should I convert that in Array? if yes How do I do it?

And once I do it I want to retrieve that and set it in a different Calendarview just to show. Plaese I am new at android, hope somebody can help.

Community
  • 1
  • 1
A ti te digo
  • 21
  • 1
  • 6

1 Answers1

0

The selectedDays returns SelectedDays<CalendarDay> That contains only the first and last CalendarDay

Seems the solutions is to manually get all days in between. See genarate dates between two date in android answer to get a List<Date>

Then if you want to make an array out of that you can use the following:

dates[] array = new Date[list.size()];
list.toArray(array); // fill the array

Maybe you also need DateFormatter to correctly formate the date. Or once you have the List<Date> You can also just loop through the list and save them in a String array one by one by using the toString() method on the date.

Community
  • 1
  • 1
QVDev
  • 1,093
  • 10
  • 17