Questions tagged [preference]
445 questions
2
votes
4 answers
How to validate an EditTextPreference value for a specific int range
I want to validate an EditTextPreference value to be inside a specific int range (lets say 1 to 22). The only part that I could validate was the inputType (number only) with the following xml declaration in the prefs.xml…

sotoz
- 3,100
- 3
- 34
- 41
2
votes
1 answer
Populate ListPreference with a list of supported camera picture sizes
I'm in the middle of developing a camera app, and what I need to do is provide a list of resolutions compatible with the user's device. Getting that list is no problem, I can just use the getSupportedPictureSizes() method. However the bit I'm stuck…

William Stewart
- 841
- 1
- 14
- 27
2
votes
2 answers
Weird behavior after upgrading to androidx.preference:preference-ktx:1.2.0
I am using Google Map in my Android app, was working properly, now after upgrading
androidx.preference:preference-ktx from 1.1.0 to 1.2.0,
Google Maps stopped displaying map tiles, but everything else is working, tap on map works, ...

AVEbrahimi
- 17,993
- 23
- 107
- 210
2
votes
0 answers
How do I refresh a specific Preference in Custom PreferenceActivity on Android?
First get your preference and then add/remove it.
The key comes from your preference.xml file (or however you have named it)

Cam
- 988
- 1
- 12
- 25
2
votes
1 answer
Get an image URI in a preference screen!
So, what I'm actually looking for is this solution: Get/pick an image from Android's built-in Gallery app programmatically but working in a preference and not in an activity.
I created a class that I put in my setting and I want to use that class to…

widgg
- 1,358
- 2
- 16
- 35
2
votes
1 answer
Custom values in xml
res/xml/prefs.xml file:

Paxmees
- 1,540
- 1
- 15
- 28
2
votes
0 answers
pre-populate shared preference file
I'm just starting to write a new android app and wanted to have a clean design.
I want some variables to be initiated with a default value. Those default values should all be in one file called settings (or something similar). However the user…

Ouli
- 21
- 1
2
votes
1 answer
How can I change the gravity of a preference page to RIGHT?
How can I change the gravity of a preference page to RIGHT?
is there any solution?

Bob
- 22,810
- 38
- 143
- 225
2
votes
2 answers
How to mark an Icon on the right of a Preference Item in the PreferenceActivity?
Please click to see the image
http://i1094.photobucket.com/albums/i455/tdounnyy/device.png
At the bottom of this PreferenceActivity, the "Select ringtone" has an icon/button on the right side.
And "Vibrate" does not.
This Vibrate Preference is one…

tdounnyy
- 23
- 1
- 5
2
votes
2 answers
findViewById fails in onViewCreated of a PreferenceFragment, Android
I have two fragments :
- HomeFragment that extends Fragment
- SettingsFragment that extends PreferenceFragment
Each one contains a TextView that I wish to access and modify its content in the Java code. I make this modification inside the…

MMasmoudi
- 508
- 1
- 5
- 19
2
votes
0 answers
PreferenceFragmentCompat, crash with EditTextPreference
I have a settings XML file, implemented in a PreferenceFragmentCompat class. In the XML file, I have a "android.support.v7.preference.EditTextPreference" in a "android.support.v7.preference.PreferenceScreen" like this…

deveLost
- 1,151
- 2
- 20
- 47
2
votes
2 answers
Which volume of TAOCP should I start with?
I have decided to go through "The Art Of Computer Programming" series by Sir Donald Knuth.
Based on your experience, please suggest which volume would be a good one to start with, as in an easier one (relative to others) and also, please suggest…

Mahesh Velaga
- 21,633
- 5
- 37
- 59
2
votes
1 answer
PreferenceActivity display/edit the values of a domain object
Given this code, how do I get the values from the checkbox- and textpreference and store them in the domain object?
public class MonitorPreferences extends PreferenceActivity {
private PersistenceManager pm;
private Monitor monitor;
…

Holm
- 982
- 2
- 12
- 20
2
votes
2 answers
How to set a DefaultSharedPreferences value?
I have a preferences activity with a checkbox "Enable Service".
I read the value like this :
SharedPreferences prefs =
PreferenceManager.getDefaultSharedPreferences(con);
ServiceEnabled_Pref = prefs.getBoolean("EnableService", true);
ok, but how…

Alex
- 2,213
- 4
- 32
- 44
2
votes
1 answer
Get preference in mainactivity
I've got a Preferenceactivity with a Preferenceswitch.
By default my app launches with fragment 1, how can I do that if Preferenceswitch is fliped/activated, fragment 2 launches at app start?
What I'm looking for is the command to access the…

Makarele
- 59
- 9