2012-06-06 2 views
3

환경 설정 화면을 열 때 EditTextPreference를 열려고합니다. 시도해 봅니다.공개 환경 설정 화면에서 EditTextPreference를 여는 방법

mLabel = (EditTextPreference) findPreference("labelKey"); 
mLabel.getDialog().show() // this does not work. getDialog return null 
mLable.getEditText().requestFocus(); // this does not work too. 

어떻게하면됩니까?

답변

3

나는 당신이 당신의 환경 설정 (??)을 열 자마자 바로 당신의 환경 설정 스크린 안에서 하나의 환경 설정을 열어야한다고 이해한다.

당신은 이것 좀해야 할 수 있습니다 : 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);