I am trying to implement the settings activity according to the guidelines. I have an EditTextPreference
that I want to keep, but instead of allowing the user to type in any value, the value should come through Bluetooth (i have the Bluetooth part ready).
At the moment, when the EditTextPreference
is clicked, it shows the editor popup with okay and cancel buttons. That's how I want it to be, so I can handle the OK
or Cancel
click events.
1) The first problem is that the keyboard also shows up - I don't want that, because the value should come from the background. I've added these properties, but nothing seems to have any effect on hiding the keyboard(even if I switch them around):
<EditTextPreference
android:selectable="true"
android:enabled="true"
android:editable="true"
android:focusable="false"
android:focusableInTouchMode="false"
android:cursorVisible="false"
android:capitalize="words"
android:inputType="none"
android:maxLines="1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="@string/pref_title_id" />
2) The second problem is: how do I update the value of the EditTextPreference
from the code behind, so the user doesn't have to type in anything, but just to see the value and click okay or cancel?
3) Third problem / question: is it okay to save the values in a database instead of using the shared preferences? Basically, I want to have the common settings UI, but keep the values in a database.
I hope that someone has had the same issues as me, because I was unable to find any solutions on the internet.