1

I have an EditText with a button next to it. The button adds the keyword from the EditText to a list and clears the EditText so that the user can enter another keyword. Every time the button is pressed, the keyboard goes away. I have tried android:focusable="false" and android:focusableInTouchMode="false" on the button and I have tried editText.requestFocus() in the button on click method. The keyboard still disappears. The behavior I want can be seen in the Google Messenger app and the Out of Milk app (and probably many other todo list apps).

cambunctious
  • 8,391
  • 5
  • 34
  • 53

2 Answers2

0

Can't comment yet, but I've used the first code block in an app I have for adding a filter window (consisting of an edit text, a set of toggle buttons and a set of check boxes) in a click listener and showing the keyboard. I assume it would work with the text view already visible. Just getting focus doesn't open the keyboard automatically, or else it didn't for me either.

http://developer.android.com/training/keyboard-input/visibility.html

Will add code tomorrow if still open.

kendavidson
  • 1,430
  • 1
  • 11
  • 18
0

I had an override dispatchTouchEvent in my activity to do the exact opposite thing. I wanted the keyboard to disappear when tapping outside of another EditText. I could share the code but I think it is arbitrary. In the end, it helped a lot to really understand touch events by reading this article.

cambunctious
  • 8,391
  • 5
  • 34
  • 53