EditTextPreference not showing numeric keyboard after migrating project to androidx












0















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"


EditTextPreference keyboard










share|improve this question























  • 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
















0















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"


EditTextPreference keyboard










share|improve this question























  • 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














0












0








0








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"


EditTextPreference keyboard










share|improve this question














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"


EditTextPreference keyboard







android android-studio android-preferences androidx edittextpreference






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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



















  • 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












1 Answer
1






active

oldest

votes


















1














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!






share|improve this answer























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    1














    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!






    share|improve this answer




























      1














      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!






      share|improve this answer


























        1












        1








        1







        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!






        share|improve this answer













        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!







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 11 '18 at 15:18









        fdonadiofdonadio

        163




        163
































            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Tonle Sap (See)

            I get strange results when I access the Sqlitedatabase with Unity C# via XAMPP

            Guatemaltekische Davis-Cup-Mannschaft