Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9090543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:23:45+00:00 2026-06-16T22:23:45+00:00

The Preference Screen XML; note that one preference is numberDecimal. <PreferenceScreen xmlns:android=http://schemas.android.com/apk/res/android > <EditTextPreference

  • 0

The Preference Screen XML; note that one preference is “numberDecimal”.

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
    <EditTextPreference
        android:inputType="textCapWords"
        android:key="tsName"
        android:title="@string/pref_common_test_name_title" />
    <EditTextPreference
        android:inputType="numberDecimal"
        android:key="tsSledWeightValue"
        android:title="@string/pref_cof_test_sled_weight" />
</PreferenceScreen>

The Preference onClick method: now I want to determine if that preference’s input type is “numberDecimal”, because I want to call custom editor.

private static Preference.OnPreferenceClickListener sBindEditorToPreferenceClickListener = new Preference.OnPreferenceClickListener() {
    public boolean onPreferenceClick(Preference preference) {
        boolean isHandled = false;
        if (preference instanceof EditTextPreference) {
// *******  CAN I FIND THE PREFERENCE'S "inputType" HERE?
// ******* EXAMPLE: if(preference.inputType == android:numberDecimal) {}
        }
        return isHandled;
   }
};

EDIT: Or is there a better way to implement this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T22:23:46+00:00Added an answer on June 16, 2026 at 10:23 pm
     if(preference instanceof EditTextPreference) {
        EditText prefText = ((EditTextPreference) preference).getEditText();
        int type = prefText.getInputType();
        //do stuff
     )
    

    Though it seems to be a bit strange. What are you really trying to do? Figure out which one was clicked? Just assign different click listeners.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following preference screen in my app <PreferenceScreen xmlns:android=http://schemas.android.com/apk/res/android> <EditTextPreference android:key=edittexvalue android:id=@+id/edittextvalue
I have the following code in my application in res/xml/preferences.xml: <PreferenceScreen xmlns:android=http://schemas.android.com/apk/res/android> <PreferenceCategory android:title=Wi-Fi
<?xml version=1.0 encoding=utf-8?> <PreferenceScreen xmlns:android=http://schemas.android.com/apk/res/android> <PreferenceCategory android:title=Notifications> <CheckBoxPreference android:key=vibration android:title=Vibrate android:summary=Vibrate phone for notifications
I defined my preferences in xml file like the following: <PreferenceScreen xmlns:android=http://schemas.android.com/apk/res/android> <PreferenceScreen android:title=@string/pref_screen
I have the following XML. <?xml version=1.0 encoding=utf-8?> <PreferenceScreen xmlns:android=http://schemas.android.com/apk/res/android> <PreferenceCategory android:title=@string/preference_xxx_category> <CheckBoxPreference android:title=@string/preference_xxx_dual_mode_title
I am doing a preferenceScreen with this xml code: <PreferenceScreen xmlns:android=http://schemas.android.com/apk/res/android android:orderingFromXml=true> <PreferenceCategory android:key=pref1
Consider this preferences.xml file: <?xml version=1.0 encoding=utf-8?> <PreferenceScreen xmlns:android=http://schemas.android.com/apk/res/android android:title=@string/preference_main> <PreferenceScreen android:title=@string/preference_sight android:key=category_sight> <ListPreference
I have a common PreferenceCategory named common.xml : <?xml version=1.0 encoding=utf-8?> <PreferenceCategory xmlns:android=http://schemas.android.com/apk/res/android >
I have PreferenceActivity with some sample content: <?xml version=1.0 encoding=utf-8?> <PreferenceScreen xmlns:android=http://schemas.android.com/apk/res/android> <PreferenceCategory android:title=First
I'm writing a preference screen in in xml for my Android application. My issue

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.