preferences

Save login details(preferences) android

主宰稳场 提交于 2019-12-03 21:25:36
问题 I have one android app with login, logout functions. The login form contains Username and password and the login button. I want to save the username and the password when the user checks the "Remember me" check box. My project.java file is shown below: public class project extends Activity { private static final int IO_BUFFER_SIZE = 4 * 1024; /** Called when the activity is first created. */ public int user_id,current_user_id; public String access_token,username,current_username; public

Java Preferences and Internationalization (i18n)

旧街凉风 提交于 2019-12-03 17:41:59
问题 The Java tutorials recommend using the Preferences API over Properties files. Properties files and ResourceBundles are the recommended way to handle Internalization requirements in applications. I am considering using both for a desktop application that will display preferences in a locale specific way. Can anyone point out problems with this approach? Maybe I should just use Properties files period? 回答1: I am considering using both for a desktop application that will display preferences in a

Remove unwanted blank line eclipse editor

寵の児 提交于 2019-12-03 17:15:18
问题 When i open any file in eclipse. it show alternative blank line after all the code lines and blank line. how can i remove it.... 回答1: In eclipse preference setting you can remove all the unwanted blank lines. Eclipse: Window > Preferences > Java > Code Style > Formatter > Edit the formatter and following screen will pop up. And when you format the code all unwanted blank lines will be removed. 回答2: Find: ^\s*\n Replace with: (empty) 回答3: Maybe you didn't understand what Anshu said. Do a Ctr-F

Liferay: how to save to portlet user information?

。_饼干妹妹 提交于 2019-12-03 16:42:39
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 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> <portlet-name>ThePortletWitchUserSpecificPreferences</portlet-name> <icon>/icon.png</icon> <preferences

How to dynamically add preferences into preferences screen and bind their values?

我只是一个虾纸丫 提交于 2019-12-03 14:48:27
I'm new in Android. In my app i want to do something like this: I have a container and i want to add item dynamically to it, in one item there may be some fields, so tree would be like this: main container - item 1 --field 1 --field 2 ... --field n - item 2 --field 1 --filed 2 ....... - item n --field 1 --field 2 ... field n I want to do this using preferences, cause i need store user's info in app, but don't know how. Can you help me, please? Katharina You need to create an xml file with an empty PreferenceScreen : <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http:/

starting an activity from preferences.xml

五迷三道 提交于 2019-12-03 14:02:54
I'm trying to go to the settings screen found at - android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS From an entry in my preferences activity but am having no luck. At the moment, pressing the entry just refreshes the same screen as I was on. My preferences.xml looks like this: <Preference android:title="@string/my_location_settings"> <intent android:action="android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS"> </intent> </Preference> And my manifest entry looks like this: <activity android:name=".Preferences"> <intent-filter> <action android:name="android.provider.Settings

How to refresh Sublime Text 3 workspace color schemes?

孤街浪徒 提交于 2019-12-03 13:08:31
When you save a project, Sublime Text will create a .sublime-workspace file. In this file, there is an array of buffers, and for each buffer there is a color_scheme property. This is set to whatever color scheme was chosen when the buffers and workspace were created. I recently changed my theme and color scheme in my user settings file. How can I refresh all of my project's workspaces so that way it uses my new color_scheme provided in my user preference file without needed to edit each project's workspace file one-by-one? Expanding on the answer given by Tot you can do this for all views in

Is it possible to load ListPreference items from an adapter?

对着背影说爱祢 提交于 2019-12-03 13:08:09
I'm setting out to create a settings activity for my app. I've defined a PreferenceActivity with a nice layout including a ListPreference object for the user to select a bluetooth device. I'm having trouble dynamically populating the list . I would like to populate ListPreference with values from an array adapter (which I'll create and populate with relevant bluetooth device names). If this were a spinner View, I could just call setAdapter() . However with the ListPreference object I can't figure out how to attach an adapter ( findviewByID won't cast from View To ListPreference , so I can't

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

跟風遠走 提交于 2019-12-03 12:16:34
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? Yes, the value is persistent but only for the user. It won't be there for other users. This is OS specific. For Windows it uses the registry, for Linux I believe it uses hidden files in

Add buttons to PreferenceFragment

我们两清 提交于 2019-12-03 11:52:58
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().replace( android.R.id.content, new PrefsSettingsFragment()).commit(); } } PreferenceFragment