Samsung Galaxy Tab 4 - Keyboard set to InputTypes.ClassNumber does not show a dot/comma

majomamajoma DEUniversity ✭✭
edited November 2015 in Xamarin.Android

Hi all,

I have a problem with my Samsung Galaxy Tab 4 - SoftKeyboard.
For a specific group of edit texts I want to show just a SoftKeyboard with numbers and a dot/comma (accepting dot or comma dependent from current culture setting via KeyListener).

My code snippet for getting this number keyboard is:

var _sensorOffset = View.FindViewById<EditText>(Resource.Id.editText_sensor_offset_value);
_sensorOffset.InputType = InputTypes.ClassNumber;
_sensorOffset.KeyListener = DigitsKeyListener.GetInstance("0123456789-" + 
                                             CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator);

This works fine for most of the devices, e. g. my Google Nexus 5 with Android M 6.0.

But for some devices it does not work, e. g. for Samsung Galaxy Tab 4.
There I always get a Number keyboard WITHOUT a dot/comma so it is not possible to enter floating point numbers.

I read through a lot of posts and discussions, but whatever I try it does not work.
I also tried proposals like using, e. g.

_sensorOffset.InputType = InputTypes.ClassNumber;

Always the same number soft keyboard shows up. The only workarounds I found are to:

a) Install another SoftKeyboard, e. g. the Jelly Bean Keyboard 4.3 -> works fine.

or

b) assign _sensorOffset.InputType = InputTypes.ClassText; -> not nice to allow entering letters and afterwards do a lot of validation checks.

I also read that this is a known issue for some Samsung Galaxy Devices that dot/comma is not visible on soft keyboard, but I cannot really believe this.

Did I miss something completely here? I will be very thankful for some hints.

Thanks in Advance and Best Regards

Marc

P.S. Attached are some screenshots:
1.) Google Nexus 5 with Android 6.0 -> works like expected
2.) Galaxy Tab 4 with Android 5.0.2 and Default Samsung Keyboard -> No dot/comma at all
3.) Galaxy Tab 4 with Android 5.0.2 and Jelly Bean Keyboard 4.3 -> dot/comma available, but some additional buttons shown.

Posts

  • AndreasBrostenAndreasBrosten USMember ✭✭

    We experience the exact same problem and have identified the same workarounds. Did you ever find any other solution?

  • LjusnanLjusnan DEMember ✭✭✭

    For Samsung devices (resp. for the Samsung keyboard) you have to override InputType in your own EditText class, for example call it "EditTextNumericDecimal".

    And now do the override like this:

    public override InputTypes InputType
    {
        get
        {
            return InputTypes.ClassNumber | InputTypes.NumberFlagDecimal;
        }
        set
        {
            base.InputType = value;
        }
    }
    

    And yeah, I know this is messed up...

  • majomamajoma DEUniversity ✭✭

    Hello Andreas, hello Ljusnan,
    sorry, it is a long time ago when I have posted this thread. Today I saw your comments.
    We never found a solution for that. We have decided some point in time to life with the workaround.
    Every combination for InputType Flags we did in XML or programmatically in C# does not solve the problem for us.
    I did not tried the exact solution posted above by Ljusnan, but currently I don't have the time to try it out.
    Perhaps some point in time I will come back to this issue.
    Thanks and Best Regards
    Marc

Sign In or Register to comment.