preferences

Best practices for handling user preferences in an iPhone MVC app?

旧时模样 提交于 2019-12-18 04:24:15
问题 I'm developing my first iPhone app, and while implementing user preferences, I have a few questions on how to best implement this. Assume the basic MVC pattern: MainView displaying data stored in a Model object; MainViewController handling the app logic. For the options, I have an OptionsView and an OptionsViewController. A RootViewController handles swapping of the Main and Options views. First of all, what about the options data? Would I want to make an NSOjbect-derived class to store them

Update existing Preference-item in a PreferenceActivity upon returning from a (sub)PreferenceScreen

允我心安 提交于 2019-12-18 04:12:49
问题 I have a PreferenceActivity with a bunch of (Sub)PreferenceScreens. Each such (Sub)PreferenceScreen represents an account and has the account-username as its title. PreferenceScreen root = mgr.createPreferenceScreen(this); for (MyAccountClass account : myAccounts) { final PreferenceScreen accScreen = mgr.createPreferenceScreen(this); accScreen.setTitle(account.getUsername()); // add Preferences to the accScreen // (for instance a "change username"-preference) ... root.add(accScreen); } As the

Get preferred screen brightness in Android

走远了吗. 提交于 2019-12-17 22:33:54
问题 How do you get the preferred screen brightness in Android? To change the screen brightness I use WindowManager.LayoutParams.screenBrightness. According to the documentation: This can be used to override the user's preferred brightness of the screen. A value of less than 0, the default, means to use the preferred screen brightness. 0 to 1 adjusts the brightness from dark to full bright. When screenBrightness is less than 0 I would like to start with the preferred screen brightness. How can I

Can SharedPreferences be shared among different Android applications?

蹲街弑〆低调 提交于 2019-12-17 16:37:11
问题 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

Android: application-wide font-size preference

被刻印的时光 ゝ 提交于 2019-12-17 05:45:06
问题 Is it possible to make an application-wide setting for the font-size to be used by all views displaying text? I would like to provide a Preference to the user which should allow scaling all text in the app. Android explicitly allows using the "sp" dimension unit for scalable text, however there is no actual way to set the "user's font size preference" in a global way. Iterating through all views on Activity instantiation is not really an option ;-) 回答1: Here it's how I made it for my app. In

Referencing a string in a string array resource with xml

拟墨画扇 提交于 2019-12-17 02:33:45
问题 I have preferences where you can enable/disable what items will show up on the menu. There are 17 items. I made a string array in values/arrays.xml with titles for each of these 17 items. I have preferences.xml which has the layout for my preferences file, and I would like to reference a single item from the string array to use as the title. How can I do this? In the Android developer reference, I see how I can reference a single string with XML, but not how I can reference a string from an

Flaw in the Lunar Lander example (IllegalThreadStateException)

徘徊边缘 提交于 2019-12-14 01:59:13
问题 I've been playing around with the lunar lander example and have run into a problem while trying to implement an about screen. I changed one of the menu items (in onCreateOptionsMenu) to an "about" option. When this option is selected, a new Activity starts and displays an about screen. @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_ABOUT: startActivity(new Intent(this, About.class)); return true; //Other cases } return false; } This works

When to use Stored Procedures instead of using any ORM with programming logic?

◇◆丶佛笑我妖孽 提交于 2019-12-13 14:11:37
问题 Hi all I wanted to know when I should prefer writing stored procedures over writing programming logic and pulling data using a ORM or something else. 回答1: Stored procedures are executed on server side. This means that processing large amounts of data does not require passing these data over the network connection. Also, with stored procedures, you can build consistent complicated business logic. Say, you need to update the account balance each time you insert a transaction, and you need to

How to deploy a Java Swing application with an embedded JavaDB database?

删除回忆录丶 提交于 2019-12-13 14:10:40
问题 I have implemented an Java Swing application that uses an embedded JavaDB database. The database need to be stored somewhere and the database tables need to be created at the first run. What is the preferred way to do these procedures? Should I always create the database in the local directory, and first check if the database file exist, and if it doesn't exist let the user create the tables (or at least show a message that the tables will be created). Or should I let the user choose a path?

How to change imageview background color in a preference in android?

蓝咒 提交于 2019-12-13 06:29:09
问题 I tried to solve my problem so i changed so much code. I change even title of the post. I can change the color of imageview background in preferences ui successfully. But after leaving fragment and launch again, the ui can not be updated in the same way as before. First of all, I use sherlockactionbar . There are 3 tabs . when 3rd bar is pressed, a fragment is , including buttons, is loaded. When one of button is pressed, another preference fragment is loaded. The code below shows how to call