android-preferences

Android - No getEditText method in EditTextPreference with Preference Support Library

[亡魂溺海] 提交于 2021-02-18 21:54:12
问题 I've just had to change to using PreferenceFragmentCompat for implementation of permissions checking which means using the support version of EditTextPreference. Unfortunately it seems getEditText is missing. Is there any work around? Update Found this issue logged. Seems it's deliberately been removed but the answer doesn't explain how to implement what I want to do. The code I was using is as follows final EditText editTextTL; editTextTL = ((EditTextPreference) findPreference("my_preference

Android - No getEditText method in EditTextPreference with Preference Support Library

自古美人都是妖i 提交于 2021-02-18 21:53:29
问题 I've just had to change to using PreferenceFragmentCompat for implementation of permissions checking which means using the support version of EditTextPreference. Unfortunately it seems getEditText is missing. Is there any work around? Update Found this issue logged. Seems it's deliberately been removed but the answer doesn't explain how to implement what I want to do. The code I was using is as follows final EditText editTextTL; editTextTL = ((EditTextPreference) findPreference("my_preference

Android testing preferences fragment by Expresso

ぐ巨炮叔叔 提交于 2021-02-10 05:21:24
问题 I have got a problem with testing my code by Expresso. I wrote this code: public class SettingsActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getFragmentManager().beginTransaction() .replace(android.R.id.content, new SettingsFragment()) .commit(); } public class SettingsFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

Android testing preferences fragment by Expresso

放肆的年华 提交于 2021-02-10 05:19:45
问题 I have got a problem with testing my code by Expresso. I wrote this code: public class SettingsActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getFragmentManager().beginTransaction() .replace(android.R.id.content, new SettingsFragment()) .commit(); } public class SettingsFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

How to add ripple effect to preferences in android?

蓝咒 提交于 2021-02-07 11:58:42
问题 I am working on adding ripple effect when the preference is touched (selected). I have customized my preference by extending the ListPreference . I have tried to set the ripple effect programmatically by using RippleDrawable but I don't see the animation. Here is my customized preference class public class CustomListPreference extends ListPreference { public CustomListPreference(Context context, AttributeSet attrs) { super(context, attrs); } public CustomListPreference(Context context) {

How to handle click events on custom items in the preference(PreferenceFragment)?

别说谁变了你拦得住时间么 提交于 2021-01-29 05:06:40
问题 I created custom layout for preference in order to add new custom item to it. I add that layout with android:layout property. My custom layout looks like that: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?android:attr/listPreferredItemHeightSmall" android:gravity="center_vertical" android

How to work with preference in single activity design using navigation component?

◇◆丶佛笑我妖孽 提交于 2021-01-28 06:20:27
问题 I want to migrate to single activity design using navigation component. I am using one activity and others are fragment. For some screens, I have only layouts, no preference. No problems to inflate those in fragment. But i faced problem when i try to work with preference. My requirements is: I need to inflate a toolbar and preference list in a fragment. My approaches: Add preference using this following code. SettingFragment.java @Override public void onCreatePreferences(Bundle

androidx.preference.PreferenceScreen not found when creating Preferences screen

醉酒当歌 提交于 2021-01-26 22:09:12
问题 After following this tutorial to create a screen for preferences, there seems to be a problem with inflating the class 'androidx.preference.PreferenceScreen'. Why is it not found when my preferences have been declared inside the res/xml folder and the necessary dependency has been added to this project? My app's minSdkVersion is 24. Error inflating class (not found)androidx.preference.PreferenceScreen dependencies dependencies { implementation fileTree(dir: 'libs', include: ['*.jar'])

androidx.preference.PreferenceScreen not found when creating Preferences screen

一个人想着一个人 提交于 2021-01-26 22:00:48
问题 After following this tutorial to create a screen for preferences, there seems to be a problem with inflating the class 'androidx.preference.PreferenceScreen'. Why is it not found when my preferences have been declared inside the res/xml folder and the necessary dependency has been added to this project? My app's minSdkVersion is 24. Error inflating class (not found)androidx.preference.PreferenceScreen dependencies dependencies { implementation fileTree(dir: 'libs', include: ['*.jar'])

androidx.preference.PreferenceScreen not found when creating Preferences screen

可紊 提交于 2021-01-26 22:00:19
问题 After following this tutorial to create a screen for preferences, there seems to be a problem with inflating the class 'androidx.preference.PreferenceScreen'. Why is it not found when my preferences have been declared inside the res/xml folder and the necessary dependency has been added to this project? My app's minSdkVersion is 24. Error inflating class (not found)androidx.preference.PreferenceScreen dependencies dependencies { implementation fileTree(dir: 'libs', include: ['*.jar'])