preferences

Dismiss android preferences dialog on Keyboard ACTION_DONE press

随声附和 提交于 2019-12-10 12:06:08
问题 I would like to be able to close the editpreference dialog (as shown here http://twitpic.com/18ttdp) by pressing the 'Done' button on the keyboard. Currently, pressing 'Done' just dismisses the keyboard but leaves the dialog. In other parts of my application I use code similar to the following to intercept the 'Done' key press and execute actions in my activity: text.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int

SwitchPreference Callback behaviour change in lollipop

谁都会走 提交于 2019-12-10 11:17:46
问题 In our project we are using SwitchPreference similar to wifi settings.user can toggle value by clicking on toggle button and user can see more options by clicking on title. But this is not working in lollipop. I can see some behaviour change in lollipop. In kitkat: When user taps on toggle button, onPreferenceChanged callback is called and when user taps on title, onPreferenceClicked is called. In lollipop: you tap on toggle button or title onPreferenceClicked is called always and after that

Using SharedPreferences across multiple classes?

懵懂的女人 提交于 2019-12-10 10:41:59
问题 I have a SharedPreferences that currently works in one class but doesn't work in a second class. I think I might be calling it wrong, because the error I get says: The method getSharedPreferences(String, int) is undefined for the type CheckPreferences The code that works correctly with the SharedPrefernces is this: public void loadApp() { setContentView(shc_BalloonSat.namespace.R.layout.main); alert = new AlertDialog.Builder(this).create(); //String returned = ""; lastpacketsPHP = ""; pref =

Cocoa equivalent of .NET's Environment.SpecialFolder for saving preferences/settings?

谁说我不能喝 提交于 2019-12-10 06:28:10
问题 How do I get the reference to a folder for storing per-user-per-application settings when writing an Objective-C Cocoa app in Xcode? In .NET I would use the Environment.SpecialFolder enumeration: Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); What's the Cocoa equivalent? 回答1: In Mac OSX application preferences are stored automatically through NSUserDefaults, which saves them to a .plist file ~/Library/Preferences/ . You shouldn't need to do anything with this file,

onPreferenceChange method isn't called when Listpreferences changes

拟墨画扇 提交于 2019-12-10 03:10:28
问题 I have a Preferences Activity in my code. I want to show a toast when ever user change radio button in a ListPreferences. I used this code but it does not work. :( public class PrefsActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.prefs); } public void onSharedPreferenceChanged(SharedPreferences arg0, String key) { ListPreference

How can I concatenate static strings with XML string resources?

佐手、 提交于 2019-12-10 02:43:28
问题 I'm trying to combine a static "hard coded" string with one referenced from strings.xml for string array items. The goal is to have a dynamic metrics list where the number is the same for all languages, but the metrics text value may change by language, something like this: <string-array name="interval_labels"> <item>30 @string/second</item> <item>1 @string/minute</item> <item>5 @string/minute</item> <item>10 @string/minute</item> <item>15 @string/minute</item> <item>30 @string/minute</item>

android custom Switch widget for SwitchPreferenc

徘徊边缘 提交于 2019-12-09 19:01:07
问题 I search around stackoverflow and find next related topics: How can i style an Android Switch? Custom switch widget in Android 4 Set switchStyle - get error resource not found - why? I also find bugreport on google group: Issue 36636: Unable to override style switchStyle And at last find new probles with Switch widget: I tried to make my own Preference.SwitchPreference and define layout with Switch widget android:id="@+android:id/switchWidget" android:layout_width="wrap_content" android

Algorithm for preference based grouping

混江龙づ霸主 提交于 2019-12-09 17:30:06
问题 I am looking to figure out a way to sort people into classes by preference. For example, say there are 100 students that are each going to be assigned one of five classes: Science - 40 seats Math - 15 seats History - 15 seats Computers - 20 seats Writing - 10 seats Each student has three preferred classes that are ordered by preference. What is the best way to approach dividing up the students so that as many people get their first and second choice classes as possible, while at the same time

Liferay: how to save to portlet user information?

扶醉桌前 提交于 2019-12-09 13:24:58
问题 I have at the welcome page a weather portlet, and user can configure the portlet and select his city. Is it possible to store user information in the portlet preferences, so that every user has his one stored city? Or what is the standard workflow to store user-portlet information without to develop own (persist) service? thx 回答1: The portlet-preferences are in liferay per default not user specific. That can be modified in liferay-portlet.xml with next lines: <liferay-portlet-app> <portlet>

Add buttons to PreferenceFragment

孤街醉人 提交于 2019-12-09 09:20:49
问题 I want to add a couple buttons to the bottom of my preferences screen for setting defaults and restoring defaults. This answer doesn't cover how to do this using PreferenceFragment. What is the recommended way to accomplish this. Activity that loads the preferences fragment: public class SettingsActivity extends Activity { @Override public void onCreate( Bundle savedInstanceState) { super.onCreate( savedInstanceState); // load up the preferences fragment getFragmentManager().beginTransaction(