preferences

Java How do you use the preference API? Where do these variables store?

北城以北 提交于 2019-12-21 03:55:16
问题 Say I have the following Preferences prefs = Preferences.userRoot().node(this.getClass().getName()); String ID1 = "Test1"; System.out.println(prefs.getBoolean(ID1, true)); prefs.putBoolean(ID1, false); //prefs.remove(ID1); Is this variable persistent the next time I execute my program? Where do these variables store? What is the proper way of utilizing this? Is the approach better than using properties files? 回答1: Yes, the value is persistent but only for the user. It won't be there for other

Show extra info for Preference screens when CheckboxPreference summary field is not enough long?

最后都变了- 提交于 2019-12-21 03:00:34
问题 I have a screen where you can enable/disable modules for my Android application. For this I use a CheckboxPreference screen. This is all good, but the summary field gets cut off if longer descriptions are added than 2 lines. Suppose I have 4-5 lines of description available for each module, I would like to display this in a helper window. I tried to bind a click event to the CheckboxPreference, but that fires for the whole line, so not only when the checkbox is clicked, and more, wherever you

How to create RadioButton group in preference.xml window?

删除回忆录丶 提交于 2019-12-20 08:48:10
问题 I'm beginner in Java Android developing. I'm using Eclipse SDK 3.6.1 version. I have a preferences window with two checkbox and one back button. <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceCategory android:title="PIN requirement"> <CheckBoxPreference android:title="Use PIN" android:defaultValue="true" android:key="checkboxPref" /> <CheckBoxPreference android:title="Don't use PIN" android:defaultValue="false"

Shared preferences, where do they go?

不羁岁月 提交于 2019-12-20 05:14:16
问题 I know how shared preferences work but I just dont know where to insert the code in the code below to save the users data.I have a login , background task that does all the work and registration .I want the app to open to a splash page when user logged in.Cant figure it out from other answers Login.java Button bttnLogin; EditText loginEmail, loginPassword; TextView regLink; AlertDialog.Builder alert; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate

Objective-C NSUserDefaults caching prevents another app from accurately reading changes

蹲街弑〆低调 提交于 2019-12-20 03:43:21
问题 I have one application that sets preferences. It uses those prefs, and so does another application. When I use the following code in the second application, it reads the preferences correctly once. NSUserDefaults* settings = [NSUserDefaults standardUserDefaults]; [settings addSuiteNamed:@"com.WVS.Wrestling-Tools"]; [settings synchronize]; // this just a shot in the dark.. didn't work [self setScoreboardIndex:[settings integerForKey:@"matName"]]; On subsequent calls of the same code, I get the

Java - Setting Preferences backingstore directory

五迷三道 提交于 2019-12-19 09:23:45
问题 I need to create a persistent storage in my Java app so all users can access it. So I was studying about java.util.prefs.Preferences and using systemRoot() works fine to me on Windows, saving data at Register. But I'm really facing some problems on Linux (Ubuntu). I want to use a directory that other of our apps already uses: /usr/share/. So, I'm trying to redirect systemRoot default directory to /usr/share at runtime. Here's my code: System.setProperty("java -Djava.util.prefs.systemRoot", "

Eclipse: create preference page programmatically

喜你入骨 提交于 2019-12-19 03:56:45
问题 I'm trying to create a preference page programmatically, I need to work with preference pages without define preferencePage extension point in plugin.xml I'm very close to solution, I'm able to load page and save the value the first time application loads, the core of my code is PreferenceManager pmngr= PlatformUI.getWorkbench().getPreferenceManager(); //this come from other plugins that implements my personal IPreferences PreferencePageRCP page =new PreferencePageRCP((IPreferences) element

Custom PreferenceScreen with clickable buttons

 ̄綄美尐妖づ 提交于 2019-12-18 08:51:38
问题 I have created following Custom Preference Screen. I want to add Listener on Button1 and Button2. How should I do it? I am using following code for creating above Preference Screen. DemoPref: import android.app.Activity; import android.content.Intent; import android.os.Bundle; public class DemoPref extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);

Can't access preferences set in account-authenticator in Android

怎甘沉沦 提交于 2019-12-18 07:00:02
问题 I'm settings a preference in a checkbox via an account-authenticator: Intent settingsIntent = new Intent("android.settings.ACCOUNT_SYNC_SETTINGS"); settingsIntent.putExtra("account", mActiveAccount); startActivityForResult(settingsIntent, ACCOUNT_COMPLETE); with the xml of: <account-authenticator xmlns:android="http://schemas.android.com/apk/res/android" android:accountType="com.example.auth" android:label="@string/auth_label" android:accountPreferences="@xml/auth_preferences" /> and in auth

Android ADT Plugin doesn't show up in Eclipse

对着背影说爱祢 提交于 2019-12-18 05:47:16
问题 I'm using Windows 7 and installed the 64 bit version of Eclipse 3.5.2. I then installed the Android ADT plugin, but when I try to configure it in the Windows > Preferences dialog, the Android Plugin doesn't show up in the left pane. Instead I see DDMS. This prevents me from specifying the location of the Android SDK (unless there is another way) to give me the appropriate templates and such. Someone posted a fix to this that includes setting the permissions of Eclipse, but that didn't work