Selecting calendar weeks with Android Studio - java

I'm looking for a possibility similar to the DatePickerDialog to select calendar weeks.
It is important that this also allows spanning calendar weeks (15-20).
The current rudimentary solution is a text field that the user fills in, but this creates a lot of potential for bugs.
Is there a way to modify the DatePicker accordingly? I haven't found much in the Android Developers documentation.
Final input should be possible in the format: 15-20, 23, 25-30. (representing calendar weeks)

Related

Ethiopian calendar in Android

I am developing an Android app for an Ethiopian company and have to deal with dates.
The calendar used in Ethiopia is similar to the Gregorian one but has two main differences: it's set approx. 7 years earlier and has 13 months.
At the time I post this question the date is 13-09-2021 in the Gregorian calendar and 03-01-2014 in the Ethiopian one.
My questions are:
does Android support the Ethiopian calendar and is it customary for people in Ethiopia to have their devices use it?
if so, do I have to get the default formatter (that uses the default calendar: Calendar.getInstance()) in order to format the date properly?
instead, if the device uses the Gregorian calendar how does Java support the translation to the Ethiopian date?
What would you suggest in order to simulate the full scenario, with the device set with the proper current Ethiopian date (as if coming from the network provider) and locale?
While I know nothing about these calendaring systems, perhaps…
ThreeTen-Extra
Add the ThreeTen-Extra library to your project to access the EthiopicChronology class that plugs into the java.time framework bundled with Android.
This chronology defines the rules of the Ethiopic calendar system. This calendar system is primarily used in Ethiopia. Dates are aligned such that 0001-01-01 (Ethiopic) is 0284-08-29 (ISO).
You can also find a CopticChronology class there too.
About the calendrical background:
The Ethiopian calendar is rather a local calendar with some popularity in Ethiopia itself. And yes, there is even a special time keeping mode in this country starting the day at 6 am. However, I am not sure if the calendar is also wide-spread on mobile phones due to lack of sufficient support in the common operating systems like Android, IOS or Windows. Outside of Ethiopia, it is probably only relevant for religous minded Ethiopian people in the diaspora.
Support on Android:
You can find some support presented by the class EthiopicCalendar delivered by IBM. I strongly assume that Amharic numbers are supported (but am not completely sure). I am less confident about the support for 6 am as start of the day and counting as zero (relevant if you ask for the current date). IBM says (similar but not identical to the standard usage of Calendar.getInstance()):
EthiopicCalendar usually should be instantiated using
Calendar.getInstance(ULocale) passing in a ULocale with the tag
"#calendar=ethiopic".
The API of IBM offers a translation to the gregorian calendar and vice versa via the counted milliseconds since 1970-01-01T00:00Z. For formatting or parsing, use the dedicated formatter engine of IBM. Attention, it is not the standard formatting engine of Android. Of course, you have still to worry with strange features like counting the first month as number zero (instead of one).
Alternative library Time4A:
My library Time4A is also written for Android and is a sister project of the main lib Time4J. Both libs contain the classes EthiopianCalendar and EthiopianTime. You will find some code examples in the javadoc. Support for non-decimal Amharic numbers exists, too. These classes require a special formatting engine, too, called ChronoFormatter. Like in case of IBM, Ethiopian month names like Meskerem (even in Amharic or other languages) are well supported.
A transformation to the gregorian calendar (and vice versa) can be obtained by the expression ethiopianDate.transform(PlainDate.axis()) where the parameter denotes the target calendar (here, PlainDate is the gregorian type).

Primefaces Calendar select week instead day

I am using primefaces calendar. I want to select a week instead of selecting a day.
I found out it was possible in primefaces 2.0 to have an array of days in backbean instead of one date object. I am using version 4 and it is not possible anymore. I was thinking if i could use the week number as the pattern and use the popup calendar it will show the week number in the text field. However it worked first time i tried, but second time i want to choose a date it will only display "w". Is the anyway to make this work?
i was thinking to use a converter which convert the week number to a date because my theory is that calendar cant convert the week number to date by it self. I am not familiar using converters? I will appreciate any help.
<p:calendar value="#{bean.date}" locale="en" pattern="w">

Accessing someone else's Google Calendar in Android

I'm developing an Android application (2.3+) for my university club. Our club makes use of Google Apps for calendar, e-mail, etc. One of the accounts hosts the calendar for all of our club's upcoming events.
In my application I would like to query this calendar so I can display events coming up in the next week or month. I have access to the "magic cookie" address of the calendar.
Every tutorial/example I've seen thus far gives directions for accessing the user's calendar. How do I use the calendar API to access a calendar that isn't the user's?
The super administrator of the domain has access to all users' calendar and calendar events details.
http://support.google.com/a/bin/answer.py?hl=en&answer=33326

Android - Creating your own calendar

Is there away of creating a calendar app for android from scratch using java and xml in eclipse or is there an already made calendar.
A Calendar is simply a table, which you can create in Android. A TextView on top can be used for the current month. Clicking on a cell can open the list of events for that day.
Well, there are two ways to "create your own calendar".
The easy way is to create a client of google calendar or other service.
And the second is to create a client and server of your calendar.

Get the Next Date of the following Sunday (Not using Calendar)

I need a solution to get the next Sunday's date, please no "Calendar" I am using GWT and it does not compile.. too many errors. I need an alternate solution... I am kind of new to java and have spent two days "just" trying to programatically get the next Sundays date.. Please help me (No Calendar Class please)
Regards
You want a perpetual calendar algorithm. Several are outlined here: http://en.wikipedia.org/wiki/Calculating_the_day_of_the_week

Categories

Resources