问题标签 [edittextpreference]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - 来自 EdittextPreference 的文本
我EditTextPreference
的是这样的:
在我的 PreferencesActivity 中:
到目前为止没问题..现在,我有一个带有通知的服务。我的目标是在通知的标题中传递 namePref 值。我在服务中写了这个:
我插入name
了通知的标题,但应用程序崩溃说该名称为空..我无法解决..
java - Android EditTextPreference disable Dialog
I want to disable(not show) the Dialog, when i click the EditTextPreference in a Preference Activity.
When i click the EditTextPreference, a pop up dialog show. Now i want to disable this. I try set an onclicklistener, but the dialog show same.
I try add this to the EditTextPreference: android:clickable="false", but nothing.
android - EditTextPreference 在 OK 按下时崩溃
我有一个 PreferenceFragment 活动,它显示以下 EditTextPreference:
但是当我想更改值时,它没有显示光标,当我按 OK 时,它崩溃,返回以下消息:
偏好类代码:
我已经尝试过没有 on change 监听器,结果相同。
我究竟做错了什么?提前致谢!
最终解决方案:查看自己的答案。
android - 如何在主要活动 android 中获取 EditTextPreference 参考
如何在我的主要活动中获得对我的 EditTextPreference 的引用?
我试过这个:
但它给了我这个错误;
这是 EditTextPreference 的代码
在获得对 EditTextPreferece 的引用后,我想要做的是,使用此引用通过我的主要活动来设置 EditTextPreferece 的值。就像是;
android - 扩展 EditTextPreference 并显示 DialogMessage
我已扩展 EditTextPreference,但不会显示对话框消息。如果我以编程方式或在preferences.xml 中添加dialogMessage,就会发生这种情况。
这是我的onBindDialogView:
java - Android 如何从 SharedPreference 设置 EditTextPreference 的默认值?
这次在同一个项目中,我面临一个稍微具有挑战性的问题,在 res/xml 文件夹中的 settings.xml 文件中:
在类文件 UserData.java 中:
我在这里要做的是将上述两个 EditTextPreferences 设置为分别android:defaultValue
存储weight
和存储 。age
SharedPreferences
现在,我该怎么做呢?
编辑:提供了使用 settings.xml 文件的 Settings.java 文件:
android - 在 Android 中触发其他首选项时更新 EditTextPreference 标题
我有一个带有设置菜单的 Android 应用程序。我有一些 EditTextPreferences,当 UI 中的按钮更改时也会更改。此外,我想实现一个重置所有 EditTextPreferences 值的首选项。我现在有:
偏好.xml
SettingsFragment.java
当我脉冲重置偏好时,没有任何变化。但是,当我关闭设置片段并再次打开它时,UI 中的首选项和按钮将更改为默认值。脉冲重置首选项时如何更新按钮和首选项?
android - Android - 一旦对话框关闭,EditTextPreference 不会关闭键盘
我正在使用 inside 构建一个设置PreferenceFragment
屏幕PreferenceActivity
。除了在对话框关闭后软键盘仍然可见的烦人问题之外,一切正常EditTextPreference
,可以通过点击“取消”、“确定”或在对话框外点击。
这是我使用 API 级别 15 (4.0.3) 构建的第一个应用程序。我以前的应用程序适用于 API 级别 8 (2.2),仅用PreferenceActivity
于其设置(无片段)。在该应用程序中,键盘总是在点击取消、确定或对话框外自动关闭 - 无需代码。
现在在关闭EditTextPreference
对话框后必须对键盘的关闭进行编码是否正常?如果是这样,我需要使用哪个事件来捕获它?
android - EditTextPreference 中的 setImeOptions
我有一个 Settingsactivity(需要大的向后兼容性),我在其中从 xml 添加项目,并以编程方式添加一些项目。
到目前为止它工作得很好,但现在我又遇到了一个问题。在 xml 中,我能够为 EditTextPreference 设置“setImeOptions”,但以编程方式,我不能。Android Studio告诉我,没有这样的方法,当我尝试时。
我希望有一个人可以帮助我。
亲切的问候
java - I get an error when running PreferenceManager.setDefaultValues on a Sony D2203 but it works when running it on my Sony D2403
The Sony D2203 runs Android 4.4.2 and the D2403 runs Android 4.4.4.
The specific line in the code that is giving the error is:
This Is the logcat output of the error:
Here is the MyEditTextPreference class:
The preference XML file:
Does anyone know why I would get this problem? I can't find anything to help on the web. It seems like there must be some compatibility issue with my code between Android 4.4.2 and Android 4.4.4 but I don't know what it is.