Skip to content
This repository has been archived by the owner on Aug 7, 2019. It is now read-only.

EditText in a SwipeView: focus & backspace issues with Samsung keypad #7

Open
pflammertsma opened this issue May 22, 2012 · 1 comment

Comments

@pflammertsma
Copy link

The SwipeView works fantastically on all our devices except two Samsungs: a Galaxy S and a Galaxy S II. When an EditText is shown within one of the pages and acquires focus, text in it using the default Samsung keyboard ("Samsung keypad") can't be backspaced.

Why the backspace key doesn't work is very puzzling. I've also found that occasionally the EditText seems to lose focus such that text can't be inserted into it anymore unless focusing a different control and returning to the EditText.

There aren't any listeners on the EditText (it doesn't even have an id), and extracting its XML into an empty activity restores the desired behavior.

@pflammertsma
Copy link
Author

I've found that the problem is caused by overriding requestChildFocus(View child, View focused). I'm not exactly sure what the implications are of restoring super.requestChildFocus(child, focused) into its body, so I've specifically fixed my issue replacing the function with:

@Override
public void requestChildFocus(View child, View focused)
{
    if (focused instanceof EditText) {
        // blocking the focus of EditText may break the keyboard
        super.requestChildFocus(child, focused);
    }
    // this will now pass trackball events down to
    // onRequestFocusInDescendants
    requestFocus();
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant