Questions tagged [preferencescreen]

Represents a top-level Preference that is the root of a Preference hierarchy. A PreferenceActivity points to an instance of this class to show the preferences.

Represents a top-level Preference that is the root of a Preference hierarchy. A PreferenceActivity points to an instance of this class to show the preferences. To instantiate this class, use createPreferenceScreen(Context).

This class can appear in two places:

  • When a PreferenceActivity points to this, it is used as the root and is not shown (only the contained preferences are shown).
  • When it appears inside another preference hierarchy, it is shown and serves as the gateway to another screen of preferences (either by showing another screen of preferences as a Dialog or via a startActivity(android.content.Intent) from the getIntent()). The children of this PreferenceScreen are NOT shown in the screen that this PreferenceScreen is shown in. Instead, a separate screen will be shown when this preference is clicked.
  • 201 questions
    20
    votes
    5 answers

    Preference screen display text block

    I am trying to make a Preference screen that just has an about, contact, and legal option, all of which when clicked just show text blurb and icon in a separate page, no shared preferences or anything. I am having trouble understanding the hierarchy…
    Nick
    • 9,285
    • 33
    • 104
    • 147
    17
    votes
    3 answers

    Androidx Preferences Library vs DataStore preferences

    I had previously replaced SharedPreferences in my app with the new DataStore, as recommended by Google in the docs, to reap some of the obvious benefits. Then it came time to add a settings screen, and I found the Preferences Library. The confusion…
    17
    votes
    2 answers

    HowTo use support.v7.preference with AppCompat and potential drawbacks

    I was trying to implement preferences for an AppCompat app, using support.v7.preference. It took me a couple of days to fiddle through it, since support.v7.preference has some significant differences to the native preferences... which isn't too bad…
    14
    votes
    2 answers

    Customizing the layout of a PreferenceScreen

    My requirements Note: I need to support Android API 15 and onwards. In my PreferenceFragment I am dynamically adding PreferenceScreen's to a PreferenceCategory. PreferenceScreen as = mgr.createPreferenceScreen(context); as.setTitle(name);…
    se22as
    • 2,282
    • 5
    • 32
    • 54
    12
    votes
    3 answers

    How do I programmatically add EditTextPreferences to my PreferenceFragment?

    I am new to Android, so I need a little guidance on how to programmatically add EditTextPreference objects to my PreferenceFragment. I am pulling in a list of values from a web service. I have saved them successfully to my SharedPreferences, and I…
    codingjeremy
    • 5,215
    • 1
    • 36
    • 39
    10
    votes
    2 answers

    Android: How can make custom PreferenceScreen?

    I am trying to create a PreferenceScreen but i want the Activity design like the whole projects. How can create a custom PreferenceScreen design ?
    Basbous
    • 3,927
    • 4
    • 34
    • 62
    10
    votes
    1 answer

    Instantiating an inner class (Preference) in xml file

    When you want to access a custom view in some layout.xml file, you have two options: The view is in it's own class. Then you do The view is an inner class:
    10
    votes
    1 answer

    Android Preference Screen Layout

    I have the following preference screen in my app
    GFlam
    • 1,109
    • 4
    • 25
    • 38
    9
    votes
    1 answer

    Custom Preference Android Kotlin

    I'd like to subclass Preference to create a custom preference item in Kotlin. I am unable to get the custom preference to inflate in the Preference screen. If I remove this custom preference from my preference screen, the rest of the preferences I…
    9
    votes
    2 answers

    References a separate Android preference screen from within another Preference Screen in XML

    I have two Android Preference Screens defined in my Android app in XML. For example, Screen 1
    Tim
    • 5,767
    • 9
    • 45
    • 60
    9
    votes
    4 answers

    Preference Screen Custom Layout only works with second click

    I have a preference screen using a 'custom layout': android:layout="@layout/currencycodes" This issue is it fails to bring up the layout on the first attempt. As you see from the animated gif below, I have to retreat and try again a second time for…
    Drawn
    • 435
    • 1
    • 7
    • 20
    8
    votes
    4 answers

    Is there a way to integrate EncryptedSharedPreference with PreferenceScreen?

    I am new to android development. Currently, I would like to encrypt a custom named Shared Preference and integrate with PreferenceScreen but failed to do so. I am using dependencies: androidx.security:security-crypto:1.0.0-alpha02…
    8
    votes
    2 answers

    Nested preference screens lose theming

    I have a preference screen for my application and in the manifest I have given it a theme using: android:theme="@android:style/Theme.Light.WallpaperSettings" However when I nest another preference screen inside this one such as:
    stealthcopter
    • 13,964
    • 13
    • 65
    • 83
    8
    votes
    1 answer

    SpinnerPreference? (How to embed a Spinner in a Preferences screen)

    Planting a Spinner in a layout is straightforward, since there are so many samples and tutorials showing how to do just this. But how to I plant a Spinner in a PreferenceScreen? Is this possible/doable at all? Note: I have already conducted an…
    uTubeFan
    • 6,664
    • 12
    • 41
    • 65
    8
    votes
    2 answers

    Dynamically change data of Custom PreferenceScreen

    I am working on custom PreferenceScreen, I have created a custom screen for the settings page using PreferenceActivity. Below is my preference screen. Issue:- I need to change badge of Download data dynamically. I followed this question for…
    Niranj Patel
    • 32,980
    • 10
    • 97
    • 133
    1
    2 3
    13 14