how to prevent android material date range picker changing locale? - android

Material date range picker changes locale to Arabic when the app locale changes. I want to prevent this and always shows the default as English. how can i achieve this

Related

is there any way to change text colors of time picker at runtime?

i am trying to implement multiple themes in android and i want to change text colors of time picker programatically according to selected theme.
By using theme property in xml we can easily set a style to time picker but in my case i want to do it programatically.
android:theme="#style/timePickerPurple".

Is there an option to change Date Picker form?

I implemented date picker in my project from here: https://developer.android.com/guide/topics/ui/controls/pickers
The problem is, this date picker is in the format of regular calendar, and it takes a long time to choose faraway dates. In my app this kind of action is going to be performed all the time.
So, my question is, is there a possibility to change this calendar-like form to something faster? For example like in the picture below.
Picture of date picker i would like to make
check that library: https://github.com/florent37/SingleDateAndTimePicker
I've used it some time ago and it did almost exactly what you're looking for ;)
If it doesn't fit your needs, you can look for more 'iOS style date pickers' for Android, for example in this SO post:
ios like date/time picker for android platform
Edit:
It seems that this picker is Holo Light style and is achievable with this piece of code:
DatePickerDialog datepickerdialog = new DatePickerDialog(getActivity(),
AlertDialog.THEME_HOLO_LIGHT,this,year,month,day);
But you need to check that on your own because they might be deprecated or not working with other themes.
Did you check this for Material Design?
Here is its documentation and code.
The DatePicker widget in Android has an attribute called android:datePickerMode that has a calendar option and a spinner option.
You can use the spinner option to get the appearance of the DatePicker you are after.

Detect Android App keyboard's language selected in custom app regardless locale

Regardless of locale I want to write Android app code which applies fonts based on this app keyboard selected (soft input selected).
if (keyboard language is persian) {
apply font family persianFont and do not apply this font on existing characters
}
else if (language is English) {
apply Signika font and do not apply this font on existing characters
}
else (for every other language) use default fonts operating system allows
If you answer the question please note:
I need code to detect keyboard language and apply font family and font sizes in that language without affecting existing text.
Thanks
There's no way to do this. Keyboards are separate apps, and they handle language display on their own. There is no API for the OS to query what language they're displaying, or for the keyboard to tell the OS what language its using. The best you can do is get the OS locale, which is they language the user requested for strings to be displayed in. But you cannot detect if their keyboard is set to a language other than the locale.

Change Language of Application at time of Programming

In my app,i have used 'locale' to change language hindi in programatically.and i also used .ttf file to convert title of app sub page in hindi language.but when i change language ,the other control change language automatically..for ex,datepicker etc,
when i have to set value in textview directly,its value can't be converted in hindi .but when i have some changes regarding that value and after set value in textview,then it will convert hindi language automaetically.please give me some solution of this.
Thank you.
I can tell you from my own experiences that it will result in strange behaviour when changing the language "manually". It is not recommended. Sometimes even changing the device orientation will overwrite your changes due to the changed configuration. Just be aware that this approach is not supported or intended by Android.

How to specify DatePickerDialog locale?

I am developing an application on Android. The application has a layout to select a lenguage to use: spanish, portuguese, english, french, italian, german and galician. It works fine but when selected locale is galician, DatePicker dialog is in english. I think that it´s because Android don´t have galician language, how can I change DatePicker dialog to show data in correct locale?
Thanks in advance,
I think you have to extend the DatePickerDialog class with your own and set the text in galician.

Categories

Resources