How to set selection on the first option in PreferenceScreen

193 views Asked by At

I need to set selection on the first option in PreferenceScreen. My class is inherited from PreferenceFragment. I added my options in onResume() method by code:

getPreferenceScreen().addPreference(aPreference);

When I start my preferences app the selection is not visible, but after first press on DOWN d-pad button it appears on the first option.

How can I set the selection on the first option? Thanks.

1

There are 1 answers

1
Suresh Mewara On

final CheckBoxPreference checkMasters = (CheckBoxPreference)findPreference("masters"); checkMasters.setChecked(true);