Customize Android CalendarView - Display DropdownMenu - java

I have a project where I use a CalendarView, the built in Calendar for android.
So, I'm facing some difficulties to achieve some specific tasks for this Calendar. And I really hope I can find the solution here on StackOverflow.
Is there any possible way of setting each day on a onClickListener?
If not, Then stop reading.
This is the problem I have:
I would like to display a dropdown menu from the selected day, with a few elements that the user can select. If the user select some element, than the state will change for the dropdown menu ONLY for the selected date i.e. if user click on 13/1 the dropdown should display 10 elements. If user select one value, "lunch", then the dropdown menu must change so if user click again only "lunch" and "delete" will appear, not the other 9 elements which were displayed from first user interaction.
The problem I have here, is that the dropdown menu is connected to ALL dates, so I believe I need a onClickListener for each date in the calendar, therefore I wonder if it is possible.
I have been struggling with using different libraries from the internet, especially from GitHub without any success so I hope there's a way of achieve this via the built-in calendar.
Best regards

Is there any possible way of setting each day on a onClickListener?
Yes.
Try this way, In your onClickListener,
1. You need calendar instance.
Calendar calInstance=Calendar.getInstance();
2. SimpleDateFormatter required.
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
3. Create a Date Object
Date date = new Date();
4. Create string to store current date on each click listener.
String currentDate=sdf.format(date);
5. Perform your required operations on this currentDate that you have received.

Related

JavaFX date picker keep calendar open and select a series of days

Hello i am new to JavaFX and would like to use a date picker,in swing i used a jdate picker that allowed me to use a combo box picker(similar to the javaFX one) however also let me have an open calendar, the user could select one day or several(by shift clicking)
How do i get this on javaFX?

Display text in a textview with calendar

I have created a calendarview in Android Studio, but i am unable to find a code that will allow me to display a text after clicking on a certain date. For example, the code will allow me to show "3 people going" after i click on a date in the textview. The code should also allow me to program each date to display a certain message. Thanks
For this you have to make custom message view and show this on calendar date click. its not necessary you have to use library for this, but some calendar libraries have built=in message feature.

Java: event objects filtered by startDate just work for one-day events

i am looking for a function that helps me with the following problem:
There is a Java class called "Event". The "Event" class has the attributes "startDate" and "endDate". Some events are not just one day long they exist for example 2 weeks.
Than there is a dropdown menu where you can choose a date of the next following days. The events which have the same "startDate" of the one which is choosen will appear.
The Problem:
Events they exsist longer than just one day will only appear when you choose the "startDate". It should also appear when the event still take place on the choosen date.
For Example:
startDate is 2016-06-20
endDate is 2016-06-25
In the Dropdown you choose the date 2016-06-22, than the event will not appear.
Thank you a lot for any help.

Unable to select date in datepicker

I'm testing a widget where I have to enter a start and end date using a calender. In real life use I select the option to enter dates from a drop down, a calender then appears where I have to click a start and an end date. Only after I click on 2 days the date fields are filled. I have no problems doing this manualy but automating the test is proofing difficult. Here's a few screenshots to illustrate what I'm trying to do. After selecting the option to enter dates the following screen appears:
Here I first click the From day (24), followed by the To day (31). Right after I click 31 the calender dissappears and the two date fields are filled with my selection:
I'm trying to automate this with the following code:
driver.findElement(By.xpath(".//span[#class='DateRangePicker__DateLabel'][contains(text(), '24')]")).click();
driver.findElement(By.xpath(".//span[#class='DateRangePicker__DateLabel'][contains(text(), '31')]")).click();
Here's part of the code I'm basing this on:
<span class="DateRangePicker__DateLabel" data-reactid=".0.1.1.0.1.1.1.0.0.2.0.1:$0-2016-4.1.1.$4.$1.2">24</span>
The code does not fail but the dates are not selected either.
using datepicker in selenium - LINK
You could inspect id of from and to field. THen execute this command using javascript
$('#id').datepicker("setDate", "date_you_want_in_right_format")
Note 1: You need to follow strictly date format that allowed by datePicker
Note 2: Tested with https://jqueryui.com/datepicker/
$('#datepicker').datepicker("setDate", "03/15/2016")

Implement calender view in Android

I need to implement calender view in android. I have successfully implemented using <CalenderView>. In my scenario when I select date I will take the selected date and send it to my server. But in this when I want to go to previous or next month I need to scroll and go to next month, while scrolling any one date is selected. so I need to implement previous and next month like the image below
Is it possible to implement this previous and next month using default calenderview.

Categories

Resources