preferences

What is the best way to deal with JSON object?

旧街凉风 提交于 2019-12-06 04:29:13
问题 I have a big string that represents JSON feed. My app downloads this feed from remote web service. Questions: 1) Once I download JSON feed, where should I store it? Right now I am storing it in app Preferences and it works fine. I am just interested if there is any reason not to do that, or if there are better/faster options, like Internal Storage or something else? 2) When I am about to show data from this feed in my activity, I do something like this: JSONObject jsonObj = new JSONObject

Open application settings via Intent from preferences.xml

回眸只為那壹抹淺笑 提交于 2019-12-06 03:35:26
I would like to open the application settings by clicking on a preferences entry. So I added an intent to the preferences.xml <PreferenceScreen android:key="DELETE_DATA" android:title="@string/pref_delete_data"> <intent android:action="android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS"/> </PreferenceScreen> and I've added an Intent-filter to the AndroidManifest.xml <activity android:name=".SettingsActivity" android:label="@string/title_activity_settings" android:parentActivityName=".MainActivity"> <intent-filter> <action android:name="android.provider.Settings.ACTION_APPLICATION

Get tab-size through command line

旧街凉风 提交于 2019-12-06 02:20:37
问题 Is there an automated way of retrieving the tab size of the matlab editor and command window? Yes, you can just open the preferences window and look it up yourself, but I want it automated. Actually I think this could be generalized to retrieving any of those user preferences in the screenshot below. 回答1: I found the solution pretty quickly and after digging in thought it's best to share this link: http://undocumentedmatlab.com/blog/changing-system-preferences-programmatically/ So what you do

Android开发之--Preferences的使用

限于喜欢 提交于 2019-12-05 22:10:41
在android程序中,记录用户的偏好是个能极大提升用户体验的功能。Android里面的Preferences正式为此事而生。 Preferences可以用来记录简单的整数,布尔值,字符串等数据,且在各个Activity之间均能访问,主要用来实现程序的参数设置功能。最简单的用法是写两行代码自己创建,如下: //从应用的任意处获得Preferences SharedPreferences mPerferences = PreferenceManager .getDefaultSharedPreferences(this); //从Preferences中获得一个值,如果不存在则值为null String loginName = mPerferences.getInt("name", null); if(loginName == null){ Log.v("Preferences", "User not login"); } //获得Editor编辑Preferences的值 SharedPreferences.Editor mEditor = mPerferences.edit(); mEditor.putInt("name", "admin"); //将更新后的值提交 mEditor.commit(); 通过这种方式,应用会在自己的数据文件夹下新建一个名为 shared

Android PreferenceActivity to create a MODE_WORLD_WRITEABLE preference across applications

独自空忆成欢 提交于 2019-12-05 21:29:25
I have multiple applications that share certain data through preferences. Each app sets its preferences through a PreferenceActitivity (from xml). Two questions: How do I use/edit preferences created by one app in another app. If I figure out how to create MODE_WORLD_WRITEABLE preferences using PreferenceActivity that will solve the problem. SharedPreferences prefs = getSharedPreferences( <String referring to another package´s prefs>, MODE_WORLD_WRITEABLE); HashMap<String, String> map = (HashMap<String, String>) prefs .getAll(); String str = map.toString(); tv.setText(str); Above code returns

Can't save my Preferences after app killed

戏子无情 提交于 2019-12-05 19:28:33
Hi I'm trying to implement a settings page on my Android App. I defined a xml Preference file, where I implemented CheckBoxPreference and EditTextPreference. All the settings work perfectly while running the app, but when I kill it I lose all the settings. Preference.xml file: <PreferenceCategory android:title="Connection"> <CheckBoxPreference android:title="Auto Log-In" android:summary="Auto connect " android:key="autoLogIn" android:enabled="true" android:selectable="true"/> <EditTextPreference android:name="Server" android:summary="Change the default server" android:defaultValue="www.google

CFPreferences creates multiple files

别等时光非礼了梦想. 提交于 2019-12-05 17:05:15
I have only a little question: Why the CFPreferences-API creates multiple files in my UserPrefs-Directory? All the files have my Bundle-Identifier as name and all (except the one, the original) have added a suffix like this: com.myComp.myApp.plist <- (only this plist-file should be created) com.myComp.myApp.plist.0qzcicc com.myComp.myApp.plist.8dhjfht This looks very much like a side effect of atomic writing. Atomic writing means that, whenever a file is to be written from an NSData (or other) object, the file is first created using a temporary file name in the same directory. Then all data is

android shared preferences example for high scores?

牧云@^-^@ 提交于 2019-12-05 16:53:34
Hi I was wondering is there any simple example of implementing a high score list using shared preferences? ie have pre determined high scores at the start and then update the list dependingt on the score a user gets? If you want to use shared preferences the problem is that you can't really store a list or something like that. Shared preferences only supports boolean, float, int, String, long and Set. So your best choice is the Set. There you can convert each value of your highscore to a string, add it to a Set and then store this set in the shared preferences. During startup of your

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

空扰寡人 提交于 2019-12-05 15:06:17
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? 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, NSUserDefaults will handle everything for you. If you have a data file in a non-document based application (such

Why doesn't VS 2008 IDE remember my preferences?

混江龙づ霸主 提交于 2019-12-05 11:59:16
This is a very petty question that I'm only asking while compiling ... ;) For some reason my VS 2008 IDE doesn't remember my window preferences when I close & reopen - it resets the window widths, locations, appearances etc. Where's the secret switch so that my IDE stays looking the way I want it? Try resetting the Visual Studio Tools->Import and Export Settings->Reset All Settings Or devenv.exe /resetsettings The window positions are stored in the following file: %APPDATA%\Application Data\Microsoft\VisualStudio\9.0\windows.prf I'm guessing that you don't have write access to this file, or