Display text in a textview with calendar - java

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.

Related

How to set an exact date and time in material ui date time picker component using selenium and java?

The website I'm working with has an identical datetimepicker component to MobileDateTimePicker shown in this page.
I can get past the date selection by using xpath of the exact day I want in calendar view however that doesn't work for the hours/minutes in the analog clock view shown after selecting a date.
Is there a specific way to select hours/minutes in material ui date time picker?
(Manually clicking on exact hours/minutes get the job done but selenium is throwing Exception in thread "main" org.openqa.selenium.ElementClickInterceptedException: element click intercepted error when when clicking on span class for the respective hour/minute(s) shown in analog clock.)
Any help is appreciated. Thanks in advance.

Date picker Dialog shows only one date

I am trying to implement the date picker dialog but the dialog appears with just a single date and show rest of the date as blank what could be the reason?
This is definitely a Theme issue. The selected date is visible because of the contrast in text color and circle color. You can refer this link for understanding the anatomy of the Date Picker theme by the Material design guideline.
https://material.io/components/date-pickers#theming
Refer this answer for understanding which colors to use.
https://stackoverflow.com/a/29014475/4491971
You can use these attributes to change the colors via style
dayOfWeekBackground
dayOfWeekTextAppearance
headerMonthTextAppearance
headerDayOfMonthTextAppearance
headerYearTextAppearance
headerSelectedTextColor
yearListItemTextAppearance
yearListSelectorColor
calendarTextColor
calendarSelectedTextColor
If you share the current style and the code snippet, we can refine the answer more.

Customize Android CalendarView - Display DropdownMenu

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.

Adding an event to particular date on calendar and want to highlight that date

In my android app, I have an Activity by name AddEventActivity in which I'm adding an event with a date and save it on local storage(SQLite). Now I want to show that event on calendar with highlight.
The link which I'm following is
here
So please help me out.
Try a Custom Calendar....it is much easier and compact than you think : https://www.toptal.com/android/android-customization-how-to-build-a-ui-component-that-does-what-you-want
Thanks to AHMED AL-AMIR. I use it in this App.
You can use Decorators to add events to the Calendar view library you are using.
For more information check their documentation:
https://github.com/prolificinteractive/material-calendarview/blob/master/docs/DECORATORS.md

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")

Categories

Resources