EditTextPreference not showing numeric keyboard after migrating project to androidx
After migrating my project to AndroidX using the Migrate to AndroidX... functionality provided by Android Studio and having made changes to my dependencies accordingly to have everything running like it is supposed to, I have encountered a minor problem which I haven't been able to resolve.
To set a device number in my application I used an EditTextPreference like the following defined in my pref_screen.xml which is set in a PreferenceFragmentCompat class with
setPreferencesFromResource(R.xml.pref_screen, string):
<EditTextPreference
android:icon="@drawable/ic_perm_device_information_black_24dp"
android:inputType="number"
android:key="change_device_id"
android:maxLines="1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:summary="@string/settings_device_id"
android:title="@string/pref_title_change_device_id" />
It used to show a numeric keyboard to change the value but after migrating to AndroidX it keeps showing a normal keyboard as shown in the image below. I tried changing the inputType and defining the decimals in xml but to no avail. Has something changed to set the inputType for the keyboard after migrating to AndroidX or am I missing something obvious?
android:inputType="numberDecimal"
android:digits="0123456789"

add a comment |
After migrating my project to AndroidX using the Migrate to AndroidX... functionality provided by Android Studio and having made changes to my dependencies accordingly to have everything running like it is supposed to, I have encountered a minor problem which I haven't been able to resolve.
To set a device number in my application I used an EditTextPreference like the following defined in my pref_screen.xml which is set in a PreferenceFragmentCompat class with
setPreferencesFromResource(R.xml.pref_screen, string):
<EditTextPreference
android:icon="@drawable/ic_perm_device_information_black_24dp"
android:inputType="number"
android:key="change_device_id"
android:maxLines="1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:summary="@string/settings_device_id"
android:title="@string/pref_title_change_device_id" />
It used to show a numeric keyboard to change the value but after migrating to AndroidX it keeps showing a normal keyboard as shown in the image below. I tried changing the inputType and defining the decimals in xml but to no avail. Has something changed to set the inputType for the keyboard after migrating to AndroidX or am I missing something obvious?
android:inputType="numberDecimal"
android:digits="0123456789"

try input type as phone once
– Akash Dubey
Nov 23 '18 at 12:45
Unfortunately it did not change anything
– MasterQueue
Nov 23 '18 at 12:52
Currently using a library as a fix for this: github.com/Gericop/Android-Support-Preference-V7-Fix
– MasterQueue
Nov 26 '18 at 8:39
add a comment |
After migrating my project to AndroidX using the Migrate to AndroidX... functionality provided by Android Studio and having made changes to my dependencies accordingly to have everything running like it is supposed to, I have encountered a minor problem which I haven't been able to resolve.
To set a device number in my application I used an EditTextPreference like the following defined in my pref_screen.xml which is set in a PreferenceFragmentCompat class with
setPreferencesFromResource(R.xml.pref_screen, string):
<EditTextPreference
android:icon="@drawable/ic_perm_device_information_black_24dp"
android:inputType="number"
android:key="change_device_id"
android:maxLines="1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:summary="@string/settings_device_id"
android:title="@string/pref_title_change_device_id" />
It used to show a numeric keyboard to change the value but after migrating to AndroidX it keeps showing a normal keyboard as shown in the image below. I tried changing the inputType and defining the decimals in xml but to no avail. Has something changed to set the inputType for the keyboard after migrating to AndroidX or am I missing something obvious?
android:inputType="numberDecimal"
android:digits="0123456789"

After migrating my project to AndroidX using the Migrate to AndroidX... functionality provided by Android Studio and having made changes to my dependencies accordingly to have everything running like it is supposed to, I have encountered a minor problem which I haven't been able to resolve.
To set a device number in my application I used an EditTextPreference like the following defined in my pref_screen.xml which is set in a PreferenceFragmentCompat class with
setPreferencesFromResource(R.xml.pref_screen, string):
<EditTextPreference
android:icon="@drawable/ic_perm_device_information_black_24dp"
android:inputType="number"
android:key="change_device_id"
android:maxLines="1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:summary="@string/settings_device_id"
android:title="@string/pref_title_change_device_id" />
It used to show a numeric keyboard to change the value but after migrating to AndroidX it keeps showing a normal keyboard as shown in the image below. I tried changing the inputType and defining the decimals in xml but to no avail. Has something changed to set the inputType for the keyboard after migrating to AndroidX or am I missing something obvious?
android:inputType="numberDecimal"
android:digits="0123456789"

asked Nov 23 '18 at 12:35
MasterQueueMasterQueue
467
467
try input type as phone once
– Akash Dubey
Nov 23 '18 at 12:45
Unfortunately it did not change anything
– MasterQueue
Nov 23 '18 at 12:52
Currently using a library as a fix for this: github.com/Gericop/Android-Support-Preference-V7-Fix
– MasterQueue
Nov 26 '18 at 8:39
add a comment |
try input type as phone once
– Akash Dubey
Nov 23 '18 at 12:45
Unfortunately it did not change anything
– MasterQueue
Nov 23 '18 at 12:52
Currently using a library as a fix for this: github.com/Gericop/Android-Support-Preference-V7-Fix
– MasterQueue
Nov 26 '18 at 8:39
try input type as phone once
– Akash Dubey
Nov 23 '18 at 12:45
try input type as phone once
– Akash Dubey
Nov 23 '18 at 12:45
Unfortunately it did not change anything
– MasterQueue
Nov 23 '18 at 12:52
Unfortunately it did not change anything
– MasterQueue
Nov 23 '18 at 12:52
Currently using a library as a fix for this: github.com/Gericop/Android-Support-Preference-V7-Fix
– MasterQueue
Nov 26 '18 at 8:39
Currently using a library as a fix for this: github.com/Gericop/Android-Support-Preference-V7-Fix
– MasterQueue
Nov 26 '18 at 8:39
add a comment |
1 Answer
1
active
oldest
votes
Google has not fixed this yet. You can use takisoft's fix for this problem:
https://bintray.com/takisoft/android/com.takisoft.preferencex%3Apreferencex/1.0.0
Add to build.gradle (project):
buildscript {
...
repositories {
maven {
url "https://dl.bintray.com/takisoft/android"
}
}
....
}
Add to build.gradle (app module):
implementation 'com.takisoft.preferencex:preferencex:1.0.0'
Change the imports in your classes and the components in your XML resources:
androidx.preference.EditTextPreference -> com.takisoft.preferencex.EditTextPreference
androidx.preference.PreferenceCategory -> com.takisoft.preferencex.PreferenceCategory
androidx.preference.PreferenceFragmentCompat -> com.takisoft.preferencex.PreferenceFragmentCompat
In your PreferenceFragmentCompat subclass, change the onCreatePreferences(...) declaration to onCreatePreferencesFix(...).
... and voila! The old parameters, like numeric and singleLine will be back and work!
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53446825%2fedittextpreference-not-showing-numeric-keyboard-after-migrating-project-to-andro%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Google has not fixed this yet. You can use takisoft's fix for this problem:
https://bintray.com/takisoft/android/com.takisoft.preferencex%3Apreferencex/1.0.0
Add to build.gradle (project):
buildscript {
...
repositories {
maven {
url "https://dl.bintray.com/takisoft/android"
}
}
....
}
Add to build.gradle (app module):
implementation 'com.takisoft.preferencex:preferencex:1.0.0'
Change the imports in your classes and the components in your XML resources:
androidx.preference.EditTextPreference -> com.takisoft.preferencex.EditTextPreference
androidx.preference.PreferenceCategory -> com.takisoft.preferencex.PreferenceCategory
androidx.preference.PreferenceFragmentCompat -> com.takisoft.preferencex.PreferenceFragmentCompat
In your PreferenceFragmentCompat subclass, change the onCreatePreferences(...) declaration to onCreatePreferencesFix(...).
... and voila! The old parameters, like numeric and singleLine will be back and work!
add a comment |
Google has not fixed this yet. You can use takisoft's fix for this problem:
https://bintray.com/takisoft/android/com.takisoft.preferencex%3Apreferencex/1.0.0
Add to build.gradle (project):
buildscript {
...
repositories {
maven {
url "https://dl.bintray.com/takisoft/android"
}
}
....
}
Add to build.gradle (app module):
implementation 'com.takisoft.preferencex:preferencex:1.0.0'
Change the imports in your classes and the components in your XML resources:
androidx.preference.EditTextPreference -> com.takisoft.preferencex.EditTextPreference
androidx.preference.PreferenceCategory -> com.takisoft.preferencex.PreferenceCategory
androidx.preference.PreferenceFragmentCompat -> com.takisoft.preferencex.PreferenceFragmentCompat
In your PreferenceFragmentCompat subclass, change the onCreatePreferences(...) declaration to onCreatePreferencesFix(...).
... and voila! The old parameters, like numeric and singleLine will be back and work!
add a comment |
Google has not fixed this yet. You can use takisoft's fix for this problem:
https://bintray.com/takisoft/android/com.takisoft.preferencex%3Apreferencex/1.0.0
Add to build.gradle (project):
buildscript {
...
repositories {
maven {
url "https://dl.bintray.com/takisoft/android"
}
}
....
}
Add to build.gradle (app module):
implementation 'com.takisoft.preferencex:preferencex:1.0.0'
Change the imports in your classes and the components in your XML resources:
androidx.preference.EditTextPreference -> com.takisoft.preferencex.EditTextPreference
androidx.preference.PreferenceCategory -> com.takisoft.preferencex.PreferenceCategory
androidx.preference.PreferenceFragmentCompat -> com.takisoft.preferencex.PreferenceFragmentCompat
In your PreferenceFragmentCompat subclass, change the onCreatePreferences(...) declaration to onCreatePreferencesFix(...).
... and voila! The old parameters, like numeric and singleLine will be back and work!
Google has not fixed this yet. You can use takisoft's fix for this problem:
https://bintray.com/takisoft/android/com.takisoft.preferencex%3Apreferencex/1.0.0
Add to build.gradle (project):
buildscript {
...
repositories {
maven {
url "https://dl.bintray.com/takisoft/android"
}
}
....
}
Add to build.gradle (app module):
implementation 'com.takisoft.preferencex:preferencex:1.0.0'
Change the imports in your classes and the components in your XML resources:
androidx.preference.EditTextPreference -> com.takisoft.preferencex.EditTextPreference
androidx.preference.PreferenceCategory -> com.takisoft.preferencex.PreferenceCategory
androidx.preference.PreferenceFragmentCompat -> com.takisoft.preferencex.PreferenceFragmentCompat
In your PreferenceFragmentCompat subclass, change the onCreatePreferences(...) declaration to onCreatePreferencesFix(...).
... and voila! The old parameters, like numeric and singleLine will be back and work!
answered Dec 11 '18 at 15:18
fdonadiofdonadio
163
163
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53446825%2fedittextpreference-not-showing-numeric-keyboard-after-migrating-project-to-andro%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
try input type as phone once
– Akash Dubey
Nov 23 '18 at 12:45
Unfortunately it did not change anything
– MasterQueue
Nov 23 '18 at 12:52
Currently using a library as a fix for this: github.com/Gericop/Android-Support-Preference-V7-Fix
– MasterQueue
Nov 26 '18 at 8:39