preference

how to hide the divider between preferences in fragment

牧云@^-^@ 提交于 2019-12-05 00:47:08
I want to hide the divider between preferences in fragment. The code is below: 1.SettingsActivity.java public class SettingsActivity extends PreferenceActivity { super.onCreate(savedInstanceState); SettingsFragment settingsFragement = new SettingsFragment(); FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.add(android.R.id.content, settingsFragement, "settings"); transaction.commitAllowingStateLoss(); } 2.SettingsFragment.java public class SettingsFragment extends PreferenceFragment{ public void onCreate(Bundle savedInstanceState) { super.onCreate

How to validate an EditTextPreference value for a specific int range

蓝咒 提交于 2019-12-04 16:47:22
I want to validate an EditTextPreference value to be inside a specific int range (lets say 1 to 22). The only part that I could validate was the inputType (number only) with the following xml declaration in the prefs.xml file. android:inputType="number" The second thing that I did is to write the following code in the ListSettings activity. public class ListSettings extends PreferenceActivity implements OnSharedPreferenceChangeListener{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.prefs); SharedPreferences sp =

Android build errors

此生再无相见时 提交于 2019-12-04 03:48:55
问题 I'm getting these errors when trying to build my app in Eclipse. Things started going downhill when the compiler warned me that my .project file was missing. Then I tried to fix the project and now am getting these errors: Errors occurred during the build. Errors running builder 'Android Resource Manager' on project 'net.learn2develop.Layouts.LayoutsActivity'. Preference node "org.eclipse.jdt.core" has been removed. Errors running builder 'Android Pre Compiler' on project net.learn2develop

Allow JavaScript from Apple Events in Safari through Terminal Mac

只愿长相守 提交于 2019-12-04 02:33:57
I'm writing a program that executes do javascript in Safari. The only problem is that I'm trying to make the app give its self permission to do it. I'm trying to locate the file that handles the Safari developer preferences so that I can do this. Does anyone have any idea where this might be or how to change these settings? It's in Safari's preferences plist at ~/Library/Preferences/com.apple.Safari.plist . The key you want is AllowJavaScriptFromAppleEvents . You can set it using defaults : #to turn it on defaults write -app Safari AllowJavaScriptFromAppleEvents 1 #to turn it off defaults

How can I set the android preference summary text color?

倾然丶 夕夏残阳落幕 提交于 2019-12-03 23:55:25
On my preference screen I have a preference that when clicked opens a color picker dialog. What I would like to do is when the user selects a color, that the text summary of the preference is displayed in that color. I know I can have the summary set up like this, Currently <font color="#ff0000">this color</font> and have it display in that color. The problem is the color I am getting back is the android int color. I could use the red(), green(), blue() methods and then convert those to Hex and then combine them into a string so I could set the summary text with the new value and that works:

Converting string to uri to bitmap to display in an ImageView

ⅰ亾dé卋堺 提交于 2019-12-03 22:46:04
I have looked all over for a solution to my problem and just can't seem to figure it out. I'm sure it is probably 1 or 2 simple lines and hopefully someone can steer me in the right direction. In my app, a user can click a button that will open the gallery. Once they select an image, it will display that image in an ImageView within my app. That part is working perfectly fine. Originally, I just had it return a uri from the gallery and I would directly display that with this: imageView1.setImageURI(myUri); Well, obviously I am now running into the dreaded "Out Of Memory" error if the user

How to instantiate layout for custom preference, using android:layout attribute

淺唱寂寞╮ 提交于 2019-12-03 12:22:32
I can set appropriate layout for preference through android:layout attribute. For an example <Preference android:key="friction" android:title="@string/friction" android:layout="@layout/friction_fragment" android:shouldDisableView="true" android:defaultValue="30" android:enabled="true" android:selectable="true" android:summary="Bite friction"> </Preference> where layout is <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView

Customizing the layout of a PreferenceScreen

懵懂的女人 提交于 2019-12-03 09:24:48
问题 My requirements Note: I need to support Android API 15 and onwards. In my PreferenceFragment I am dynamically adding PreferenceScreen's to a PreferenceCategory. PreferenceScreen as = mgr.createPreferenceScreen(context); as.setTitle(name); myCategory.addPreference(as); When the settings Activity renders these PreferenceScreens are rendered with just a title in it's row, see the image below. I want to customize what is shown in this row. Ideally I would like to have a title with a summary below

EditTextPreference Disable Buttons?

人走茶凉 提交于 2019-12-03 08:32:37
I want to have an EditTextPreference that will disable the OK button if there is no text in the EditText field. I created a custom EditTextPreference class and I am able to get the EditText object and set a TextWatcher, but I can't find a way to disable the button. It looks like I just don't have access to the OK and Cancel buttons in the Dialog. Anyone know a way to get at these buttons or to do what I am trying to do? Only other option is to try to create from scratch a custom Dialog that looks like and mimics the EditTextPreference. Here is a code sample that enables/disables button

How to prevent Sublime Text 2 from opening that last open file / project when starting up

不羁岁月 提交于 2019-12-03 02:44:25
问题 I am on Lion - and in the command line, when I open up my project using "subl ." in my project folder - it opens up the last project I had open before I quit Sublime. I have the Max Preference "Restore windows when quitting" unchecked. How to I prevent this behaviour? Is there a preference setting for this? 回答1: I think the behavior you want can be enabled by changing the hot_exit and remember_open_files settings. If you check out the "Global Settings - Default" preferences, there are some