android: DatePicker background on KindleFire HD - android

I tryed to use DatePicker dialog on Kindle. But Edit fields without the background! How I can to fix it (standard-way)? You can check it in emulator. I use Android 2.2 for building application.

I was having the same problem. I was able to solve it by calling the DatePickerDialog's setInverseBackgroundForced and passing in true.

Related

android:fontFamily is only working with AppCompatTextView

I was moving my project drop Calligraphy and use the native android android support for fonts. However, I can only make it work if I use AppCompat elements instead of the default ones (TextView, Button, etc..). I wanted to know if this is expected and if not, how could I solve it?
So I figured it out:
The problem was that in on of the legacy BaseActivity#onCreate we were calling setContentView before the call to super.onCreate(). By doing this it will somehow disable the font from being correctly rendered.

Android: Different appearience on UI of date and time picker

I am using date and time picker in my application and referred the tutorial
from here but the problem is that when i run it on kitkat 4.2.2 it show output as follows: but when i run it on lollipop 5.1.1 it shows output
showing two different UI on same code i dont know how to fix this problem.I have also applied some validations on it but its working with first case but not with second case.Please help.
if you want it identical to the first one you can add
android:datePickerMode="spinner"
android:calendarViewShown="false"
This differs as per OS version in devices. It is a system date and time picker.
So it will be as per OS version and may - may not differ in each of the OS version.
Whatever you are seeing is correct and is OS level change.
I think you can force it to look a certain way by changing compilessdkversion and the targetsdkversion accordingly in your gradle file.
edit: on second thought, I'm not 100% sure it'll work...might cause problems on some versions.
The 100% positive way to get the classic spinner is like Maxi said to set the attribute datepickermode atribute to spinner.
To answer whats been asked of Maxi regarding timePicker. You have to set the timePickerMode attribute to "spinner" in a similar fashion to avoid the round clock interface and get the classic spinner.
<TimePicker
...
android:timePickerMode="spinner" />

DataPicker dialog window not showing properly in some emulator

In my application I am using Date picker dialog.During testing some emulator show date picker dialog properly but some emulator show the data picker dialog in properly.Can you explain whether this is a emulator problem or functionality problem as well as how to solve this problem.Thanks...
new DatePickerDialog(getSherlockActivity(), datePicker,
calendarTaskDate.get(Calendar.YEAR),
calendarTaskDate.get(Calendar.MONTH),
calendarTaskDate.get(Calendar.DAY_OF_MONTH)).show();
Here i enclosed the screen shot for both.
Emulator Name:
5.1" WVGA(480x800:mdpi),API level:17
Emulator Name:Nexus S(4.0",480x800:hdpi) API 12
Android's default DatePickerDialog's layout will be changed according to the API's based on its themes. For the different API's there is a different layout so if you have API below 8 it will be same as your first screenshot. As you go for higher API above 13 you will always get the different layout for your DatePickerDialog.
So Its not on our hand to maintain the same layout for DatePicker.
To me both images look ok.
If what you think is the problem is that the display is not the same it is simply due to the fact that in one emulator you use API 17 and in the other one API 12.
In those two API the look of the date picker is not the same.

Error indicators (for form validations) not shown for android 4.2?

Background
On Android, you can set an error indication for any EditText view when you want to show the user that what is typed there (or not typed) is wrong (called "form validations").
There is even a nice library for this (here) , and many post here are available of how to use it.
All worked well for me till I've ran it on a nexus 4 with Android 4.2 .
The problem
Sometimes, it just won't show the icons of the errors. In such a case , only when i give the editText (that has the problem) focus, it shows the bubble, but it's empty and doesn't show the icon of the error.
Also, in all cases, the bubbles are always empty.
Why does it occur, and how can I fix it?
Note: I use actionBarSherlock library so I need to use their themes or a theme that is based on theirs.
EDIT:
here are some screenshots:
android 4.2.2 :
android 2.3.5 :
EDIT:
after i thought that this was solved by itself, i've finally figured out when this bug occurs:
if the focus is on another editText which doesn't have an error, and the error of validation is on another editText , the indicator isn't shown till the editText gets focus.
Problem 1: The problem is the Theme of the application.
Try changing the theme to some darker theme like:
<style name="AppBaseTheme" parent="android:Theme.Black">
and it should solve your problem. I found this similar issue earlier and rectified this by changing the theme.
But I didn't research much but I feel that this is Android issue and the bubble should try to change the text colour according to the theme.
Let me know if it solves your problem, or not.
Problem 2: The other issue you are talking about for not taking focus, you may consider the following link: Text Truncating and Focus Issue.
----------------------------------------Updated Answer---------------------------------------------
Q1) What should I add to the theme configuration in order for it to always work, no matter what theme I use?
According to my findings here are some results:
[Note: Only applicable for devices running 3.0 and up]
If your build target is:
less than 11, then using
parent="android:Theme.Light" --> setError() message doesn't work or shows very faded text colour almost blending with color white
parent="android:Theme" --> setError() message works
greater than 11, then using
parent="android:Theme.Holo.Light" --> setError() message works
parent="android:Theme.Holo" --> setError() message works
Since, your project is supported for devices less than 11 API level and you want to support 4.0 and plus too, your best bet would be to go and integrate HoloEverywhere in your project which will solve your problem and you will be able to use your ActionBarSherlock too, for compatibility, check this SO Post.
Q2) What are the available configurations for the error indication UI ?
Mostly you can customise drawables and icons but I doubt you will be able to configure your text and background(If anyone knows more may point out on this)
I would suggest you to check this SO Post for immediate answers.
And for placing the correct focus, for every validation checks, you may place this code:
EditText.setFocusableInTouchMode(true);
EditText.requestFocus();
EditText.setError("My Error Text");
Let me know for any issues.

Auto Increment(+) and Decrement(-) button like time picker

Hello I'm trying to get an edit increment decrement, to no avail.
I see on Time/Date palette: Time picker, but i want only one box.
I'd like an edit like this:
Thank You!
You can use NumberPicker class. But it is available from SDK v-11. To use in projects that are aimed at SDK versions less 11, you should implement your own class. But you can use AOSP's NumberPicker class as template. Also, but I'm not sure (because I've never tried it) you can use SupportPackage.

Categories

Resources