Entry View: Soft Keyboard appears but (sometimes) can't enter text

DouglasHenkeDouglasHenke USUniversity ✭✭

I've got a Xamarin Forms app running on Android. It has various different pages, many of which have one or more Xamarin Forms "Entry" views.

Mostly, everything works great. The users taps on an Entry, it gets focus, the on-screen keyboard appears and the user can type into the Entry text.

Rarely and intermittently, my app gets into a state where pressing the keyboard keys won't cause text to appear in the Entry. The Entry still gets focus and the keyboard pops up, but pressing the keyboard buttons does nothing. Once the problem starts, it happens every time on every Entry, and the only way to get back to normal is to kill the app and launch again. I am actively looking for anything that will let me reproduce the problem reliably, but have not found anything yet.

Users have seen this problem start with various different Entry views on different pages.

Most of the Entry views in question are not part of a ListView, so I don't think it's got anything to do with ListView bindings.

Any suggestions would be greatly appreciated.

Answers

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Just a good old generic Entry?
    Not a derived control... no inheritance... No attached behaviors... No event handlers for 'keypress' etc. to validate entry in real-time... No multiple binding of the same backing property to multiple UI elements...

  • DouglasHenkeDouglasHenke USUniversity ✭✭

    The only event handlers are those for Completed, Unfocused and (in a few cases) TextChanged. (Definitely no keypress handlers.) No bindings; just using the default Text property.

    A few of the Entry views are a trivial subclass:

    public class NumberEntry : Entry
        {
            public NumberEntry()
            {
                Keyboard = Keyboard.Numeric;
            }
        }
    

    with a custom renderer to allow the entry of negative numeric values:

    public class NumberEntryRenderer : EntryRenderer
        {
            protected override void OnElementChanged(ElementChangedEventArgs e)
            {
                base.OnElementChanged(e);
                var native = Control as EditText;
                native.InputType = Android.Text.InputTypes.ClassNumber | Android.Text.InputTypes.NumberFlagSigned;
            }
        }
    
  • SmeSme USMember ✭✭✭

    I'm also experiencing this issue. I'm using the default entry as well. Happens rarely but I need to restart my app when it does happen.

  • DouglasHenkeDouglasHenke USUniversity ✭✭

    Once the problem starts, it happens every time on every Entry, and the only way
    to get back to normal is to kill the app and launch again.

    Update: That is not quite true. Apparently, putting the device to sleep (by tapping the power button) then waking it back up also resolves the problem, without re-launching the app.

  • DouglasHenkeDouglasHenke USUniversity ✭✭

    Another possible clue: A user reported an instance of this problem in a view which happened to have an alphanumeric keyboard. They report that they were able to enter alpha characters, whitespace and punctuation just fine, but that they could not enter numbers.

    To reiterate: My code did not add any TextChanged handler to the Entry in question.

  • gilleslebgillesleb Member ✭✭

    Did you find out what was happening?
    If so were you able to fix it?

    Testers have reported a somewhat similar problem for me and I can't reproduce it on my side.

  • DouglasHenkeDouglasHenke USUniversity ✭✭

    In our internal bug tracking system, it's been marked "closed" by another developer, with a comment that the problem went away when we updated to the new Zebra EMDK. (This was in March 2017, so calibrate your understanding of "new" accordingly.)

    I want to ask the person who closed the bug for more details, but they aren't in right now. I'll post here if I find out more. (Assuming they can remember anything from a year ago may be a stretch.)

Sign In or Register to comment.