I decided to avoid for now the set preferences method for setting user settings. Im a noobie to android and xml.
I have a layout that I display with various radio buttons, check boxes, and selectable imagebuttons. I would like to know how after I display the layout (nothing is set) to change the display to match the stored user preferences programatically. And also how to query each item on the layout screen for its selected state. Some of my settings.xml code. Variables for the two items are WifiOn and AirplaneOn.
<CheckBox
android:id="@+id/CkBxAutoWifiStart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:onClick="ToggleAutoWifiOnOff"
android:text="Turn Wifi On If Off" />
<CheckBox
android:id="@+id/ckBxAutoAirPlane"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:onClick="ToggleAutoAirPlaneModeOnOff"
android:text="Turn Air Plane Mode Off If On" />
You only need to set each component in the onResume of your setting activity.
First you need to have a reference to each component.
On your onResume just check in shared preferences and set the state of each component.
is that or maybe i misunderstood the question?
Regards,
Alex