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
    0
    votes
    1 answer

    For a Wear Os watchface/app, how can I request focus for the current preference screen?

    I have a Wear OS app (watch face) where the user can open a preference activity (PreferenceScreen based on PreferenceFragment) for all the user settings. I am trying to enable rotary input for the watch knob or rotary bezel, but haven't been able…
    0
    votes
    0 answers

    how to create underline in the PreferenceCategory for separating EditTextPreference

    i need the Underline after every EditTextPreference UI for the separating it . Code enter image description here enter image description here adding Image for better understanding enter image description here i have create layout .xml style and to …
    0
    votes
    1 answer

    How to create custom PreferenceScreen Class in java and set custom layout to it?

    I want to create a custom PreferenceScreen class in java having custom layout set to it. I have create the custom class for ListPreference, CheckboxPreference and set custom views. But PreferenceScreen is final class, so it is not extendable.Is…
    0
    votes
    0 answers

    Android Preference screen controller

    Given below the sample code from AOSP project. How can I added "settings:controller" class in PreferenceCategory. I created a class and got error as AAPT: error: attribute controller (aka com.example.prefscreen:controller) not found. This is the…
    Robin Baby
    • 11
    • 4
    0
    votes
    1 answer

    How to specify custom layout for a DropdownPreference?

    I want to use a custom layout for a DropDownPreference. When I specify the layout as an android:layout="@layout/mylayout", I get a runtime error. Can anyone confirm if they have done this previously?
    Maverick
    • 1
    • 2
    0
    votes
    1 answer

    Hide a Preference-item depending on the state (enabled/disabled) of another Preference in PreferenceScreen

    I'm creating a settings screen, and I have a few settings items: SwitchPreferenceCompat and my CustomPreference. I need the СustomPreference to disappear(hide) when the SwitchPreferenceCompat is turned off and appear(show) when the…
    0
    votes
    2 answers

    Modifying a preference value in a PreferenceScreen by code

    I have a PreferenceScreen following the docs here and here. One of the options is a SwitchPreferenceCompat that does some risky work in my app, for example, to send sensitive information periodically. This is the simple…
    Ton
    • 9,235
    • 15
    • 59
    • 103
    0
    votes
    1 answer

    Inconsistent behavior after isExternalStorageManager() = true in Android 11

    I added a Preference button in my PreferenceScreen to call for Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION in Android 11: prefn.setOnPreferenceClickListener(arg0 -> { Intent intent = new…
    Luis A. Florit
    • 2,169
    • 1
    • 33
    • 58
    0
    votes
    0 answers

    Android scrollbars appear inside views after opening preferencescreen

    I use navigation architecture component and if I navigate to the settings page and then I go back then lines and scrollbars appear on views. The PreferenceScreen is very simple only contains a ListPreference. SettingsFragment: class…
    Botond Sulyok
    • 271
    • 3
    • 14
    0
    votes
    1 answer

    Ugly preference screen on Samsung I5800

    I created a simple preferense screen. In emulator, it works well, but in my phone... Strange shadows below activity's title, thin lines flick when I scroll (images 2-3), and a strange bottom border of "Speed" ListPreference. All other apps'…
    Andrey Moiseev
    • 3,914
    • 7
    • 48
    • 64
    0
    votes
    1 answer

    Android Preference Screen theme not working

    I am setting up an Androidx Preference Screen with Navigation Architectural Components in my Application. For some reason, Android Preference Screen Looks like this When I switch the theme from the Android Studio theme switcher, It looks perfectly…
    0
    votes
    2 answers

    Preference Screen without XML

    I want to use preferences, but I don't want to use it in xml. I used this to find my xml: this.addPreferencesFromResource(R.xml.settings); And this is my .xml:
    0
    votes
    1 answer

    How to give contentDescription to SwitchPreference for Accessibilty/Talkback?

    I have a Preference screen having multiple SwitchPreferences. I need to give custom contentDescription to each switch for accessibility. There is no property as contentDescription for SwitchPreference. Can Anyone help me in how to give custom…
    0
    votes
    1 answer

    Osmdroid Night-Mode with Preferences

    So I want to make a CheckBoxPreference to turn on the Night-Mode in osmdroid.But the code doesn't to anything. I made the same thing without PreferenceScreen,a normal LinearLayout with a switch, it worked well, but I wanted to use the preference. …
    Pat37
    • 11
    • 4
    0
    votes
    0 answers

    Nested preferences inside fragment (from bottom navigation) - back stack not working

    Everything is working, except that I am not able to go back to the settings fragment. Why is the Fragment not called, when clicking on the back button? Structure: MainActivity -> SettingsFragment (inside NavController) -> Preferences Overview ->…