android-preferences

How to wrap a preference title? (Really)

穿精又带淫゛_ 提交于 2019-12-23 10:14:19
问题 Please don't point me to How to wrap preference title? as it doesn't work for the case where (as I commented) you use a @strings/ reference to a strings.xml file. If you use android:title="@string/some_string" and put <string name="some_string">the string I want \n to wrap</string> into strings.xml , the \n is ignored. 回答1: I think all title s inside preference screen are expected to be single line . I don't think declaring as android:title="The title of this preference\nis this." will work.

Dependent preferences display wrong color font when disabled

删除回忆录丶 提交于 2019-12-23 07:16:15
问题 In my app I am using several preferences, including some of them related with dependencies using the following attribute: android:dependency="pref_key" . Basically, when the checkbox is not selected, all the other preferences below are disabled: The problem happens when I setup back the following 3 lines in my custom theme: <style name="AppThemeOrange" parent="@style/AppTheme"> <item name="android:textColorPrimary">@color/OrangeMain</item> <item name="android:textColorSecondary">@color

SharedPreferences and Application class

拈花ヽ惹草 提交于 2019-12-23 05:52:19
问题 I have many shared preference for my app (mostly relating to color customization) and I'm unsure what the best method is to store/use them at runtime. Currently I am doing something like this (with more or less preferences depending on the view) in every activity/fragment: SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getActivity()); int buttonbg = settings.getInt("buttonmenu_bg", 0); int buttontxt = settings.getInt("buttonmenu_txt", 0); int headerclr = settings

SharedPreferences and Application class

放肆的年华 提交于 2019-12-23 05:52:18
问题 I have many shared preference for my app (mostly relating to color customization) and I'm unsure what the best method is to store/use them at runtime. Currently I am doing something like this (with more or less preferences depending on the view) in every activity/fragment: SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getActivity()); int buttonbg = settings.getInt("buttonmenu_bg", 0); int buttontxt = settings.getInt("buttonmenu_txt", 0); int headerclr = settings

Launch Intent from account-authenticator accountPreferences screen?

一世执手 提交于 2019-12-23 02:32:21
问题 I have included the AccountManager code in my app to enable the user to create and manage their account from inside their Settings application. I linked in the "accountPreferences" preferences file inside my account-authenticator definition, and the options show properly in the Settings > Accounts > My App screen. When I tap on one of them, instead of getting the activity I linked in, I get: 01-14 14:47:27.304: ERROR/AndroidRuntime(27708): FATAL EXCEPTION: main android.util

Android PreferenceFragment No view found for id for fragment

六眼飞鱼酱① 提交于 2019-12-22 10:36:32
问题 So I'm making an android application and I started dealing with preferences, when I simply use a PreferenceActivity, everything works perfectly, however, if I use it with a PreferenceFragment, it crashes right after I click the button that calls intents to SettingsActivity with an error: FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{*app package*/*app package*.SettingsActivity}: java.lang.IllegalArgumentException: No view found for id 0x7f08003d for

changing the preference category label color background

断了今生、忘了曾经 提交于 2019-12-22 10:13:39
问题 I would like to change the color of the preference category bakcgorund. In my xml with preferences I have categories typed in this way: <PreferenceCategory android:title="Synchronization"> ... </PreferenceCategory> I am trying to change the background using xml attribute: android:widgetLayout="@style/PreferenceCategory" And the code in my styles.xml looks like: <resources> <style name="PreferenceCategory"> <item name="android:background">@color/my_blue</item> </style> </resources> But it isn

Get Key, not value, of the ListPreference selection - Possible?

空扰寡人 提交于 2019-12-22 07:56:31
问题 Getting the value of the currently selected item in a ListPreference is straightforward: String selected = sharedPrefs.getString( getString(R.string.list_preference_array), "default string" ); But now I need to get the key of the currently selected item, instead. Is this possible? To clarify, a typical ListPreference definition in the XML file has the following components: <ListPreference android:key="@string/list_preference_array" android:title="Title of ENTIRE list (not seen by user?)"

How to return from preference screen to main activity?

感情迁移 提交于 2019-12-22 06:49:55
问题 I have one main activity and one preferenceActivity. On my first activity I call menu and go on preferenceActivity by calling startActivityForResult. case R.id.settings: startActivityForResult(new Intent(this, SettingsActivity.class), LAUNCH_SETTINGS); return true; Then I change my settings and want to return on main activity and see main activity with new settings applyed. In onPause() method do following (as I right understand this method will be called when I press back button, right?)

Custom inline SeekBarPreference - how to set SeekBar progress on the 1st run?

妖精的绣舞 提交于 2019-12-22 06:41:09
问题 I have prepared a simple test project for my question at GitHub. In my project there is a custom inline SeekBarPreference, which mostly works fine (its summary is updated when seekbar is being dragged and it saves integer value): However there is a problem: On the very 1st run of the app (you might need to uninstall my app when you try see the error again) the progress of the SeekBar is not set (but the summaries are set): My question is: how to fix this issue in my code? I have tried adding