summaryrefslogtreecommitdiff
path: root/core/java/android/widget/NumberPicker.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/widget/NumberPicker.java')
-rw-r--r--core/java/android/widget/NumberPicker.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java
index b6ed22c293f6..a28cc403ed56 100644
--- a/core/java/android/widget/NumberPicker.java
+++ b/core/java/android/widget/NumberPicker.java
@@ -1293,7 +1293,8 @@ public class NumberPicker extends LinearLayout {
* Shows the soft input for its input text.
*/
private void showSoftInput() {
- InputMethodManager inputMethodManager = InputMethodManager.peekInstance();
+ InputMethodManager inputMethodManager =
+ getContext().getSystemService(InputMethodManager.class);
if (inputMethodManager != null) {
if (mHasSelectorWheel) {
mInputText.setVisibility(View.VISIBLE);
@@ -1307,7 +1308,8 @@ public class NumberPicker extends LinearLayout {
* Hides the soft input if it is active for the input text.
*/
private void hideSoftInput() {
- InputMethodManager inputMethodManager = InputMethodManager.peekInstance();
+ InputMethodManager inputMethodManager =
+ getContext().getSystemService(InputMethodManager.class);
if (inputMethodManager != null && inputMethodManager.isActive(mInputText)) {
inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0);
}