preferences

How to change default download folder while webdriver is running?

笑着哭i 提交于 2019-11-28 05:10:13
问题 I am downloading several different data sets and would like each file (or set) to download to a specific folder. I have learned how to change the download directories at these page: setting Chrome preferences w/ Selenium Webdriver in Python Change the default chrome download folder webdriver C# The problem is these methods only allow me to change the download directory when I open the webdriver. It takes a while to get to the download page so doing this is an ineffective solution. I've tried

How do I get preferences to work in Android?

人走茶凉 提交于 2019-11-28 04:59:34
I've really been struggling through this. New to Java/Android. I'm writing my first app and this is the first thing that has taken me longer than a couple days of searching to figure out. Here's the setup: It's a BAC calculator / drink counter: A formula is used to calculate the BAC. Here's the forumla: Bac = ((StandardDrinks / 2) * (GenderConstant / Weight)) - (0.017 * Hours); So as you can see, being able to modify the gender and weight will produce more accurate and personalized results. So I have them as doubles: double GenderConstant = 7.5; //9 for female double Weight = 180; To change

How to do opposite of of preference attribute android:dependency?

流过昼夜 提交于 2019-11-28 04:03:50
Is there XML attribute that does the exact opposite of android:dependency ? What I would like the dependent preference to be enabled when the other is NOT checked and disabled when it IS checked. edit: maybe the issue isn't with android:dependency maybe there is an xml attribute that I can add to make the default for that preference disabled and then android:dependency will toggle it the opposite way like i want. edit again: I tried setting android:enabled="false" in the preference and it disables it like i want but even with it being dependent on the other preference it didn't enable it like

Best approach to save user preferences?

僤鯓⒐⒋嵵緔 提交于 2019-11-28 03:55:05
I have seen two different approaches in saving user preferences. APPROACH 1: Serializing them and saving in one of the column of USERS table APPROACH 2: Creating a separate table PREFERENCES and make a has_many association from USERS to PREFERENCES. Which one of the above two approaches would you prefer and what are the pros and cons of each over other? It's usually a good idea to favor normalization. The second solution keeps your models cleaner, allows for easy extensibility if new preferences are added, and keeps your tables uncluttered. Turadg I grappled with this same question so I

Tab Vs Space preferences in Vim

…衆ロ難τιáo~ 提交于 2019-11-28 02:37:49
Vim is very accommodating when it comes to tab Vs. space preferences. As I understand it, the tabstop setting indicates the width of a tab character. The shiftwidth setting specifies how many columns to increment/decrement when using the << and >> commands, whereas the softtabstop setting influences the amount of whitespace to be inserted when you press the Tab key in insert mode. If expandtab is on, the tab key inserts softtabstop number of space characters. Whereas with expandtab switched off, pressing the Tab key inserts a the smallest possible number of tab+space characters that matches

Can SharedPreferences be shared among different Android applications?

 ̄綄美尐妖づ 提交于 2019-11-27 23:58:48
As I checked in APIs description for getSharedPreferences(String, int),Second attribute is defining accessibility mode and can take 0 or MODE_PRIVATE for the default operation, MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE to control permissions. But there is this small note in API description: Note: currently this class (android.content.SharedPreferences) does not support use across multiple processes. This will be added later. Moreover in Mark L. Murphy book "beginning Android 2" he mentioned: (Eventually, preferences might be shareable across applications, but that is not supported as of the

How do you validate the format and values of EditTextPreference entered in Android 2.1?

瘦欲@ 提交于 2019-11-27 23:38:50
Does anyone have sample code to validate user entered text in preferences? For example, I have a EditTextPreference for user to enter an email address. I'd like to validate the format of email address entered and pop up an alert dialog if the format isn't correct. Anyone have any sample code for this? Thanks Your question was an early google hit when I was trying to do the same thing, so hopefully this helps someone. Here's something I hacked together today that demonstrates OnPreferenceChangeListener, thus allowing you to stop invalid changes. in your fragment: @Override public void onCreate

How to change language for a whole android application?

邮差的信 提交于 2019-11-27 18:42:44
问题 I want to write a application that can display either english or chinese. I have already prepared 2 string.xml which is value/strings.xml and value-zh-rHK/strings.xml. But I have no idea how to change the language via ListPreference of android. xml/preferences.xml: <?xml version="1.0" encoding="utf-8"?> <SwitchPreference android:key="pref_nightmode" android:title="@string/nightmode" android:defaultValue="false"> </SwitchPreference> <ListPreference android:key="pref_lang" android:title="

Remove/hide a preference from the screen

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 17:45:45
I have an activity which extends PreferenceActivity. I'm loading preferences from the xml file. But in some cases i need completely hide one of the preferences from the screen based on my app state. There is a setEnabled method, but it's not exactly what i want. I want to remove that preference from the screen completely. Is it possible ? David Hedlund Yes, if you have a reference to both the Preference , and its parent (a PreferenceCategory , or PreferenceScreen ) myPreferenceScreen.removePreference(myPreference); Kavi If your Preference is within a PreferenceCategory , you have to do this:

User preferences file vs App preferences file

对着背影说爱祢 提交于 2019-11-27 16:27:51
问题 My android application has two kinds of preferences: 1) I have user preferences defined in res/xml/preferences.xml so that users can manage their preferences with a PreferenceActivity. 2) I'd like to define another file for global configuration preferences of my app. What is the best way to manage my app config preferences? Should I create another XML file with config values or should I specify those config values in strings.xml? What is the best practice for managing config preferences? 回答1: