Reputation: 1283
I want to open EditTextPreference when I open Preference screen. I try
mLabel = (EditTextPreference) findPreference("labelKey");
mLabel.getDialog().show() // this does not work. getDialog return null
mLable.getEditText().requestFocus(); // this does not work too.
How can I do this?
Upvotes: 3
Views: 818
Reputation: 5183
If I understand you right, you need to open a single preference inside your preference screen as soon as you open your preferences (??).
You might want to have a look at this: https://stackoverflow.com/a/4869034/668240
// the preference screen your item is in must be known
PreferenceScreen screen = (PreferenceScreen) findPreference("pref_key");
// the position of your item inside the preference screen above
int pos = findPreference("abc").getOrder();
// simulate a click / call it!!
screen.onItemClick( null, null, pos, 0 );
Upvotes: 3