how to show that the radio button is selected permanently
i have the same problem as how to show the radio button is selected is still ticked? but in android platform... can anybody help me please.. my codes are
<RadioButton
android:checked="false"
android:id="@+id/BBC"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffff6600"
android:text="BBC NEWS"
android:typeface="serif"
android:textStyle="bold"
android:layout_x="10px"
android:layout_y="100px">
</RadioButton>
开发者_开发百科Thanks in advance...
You could save the value (when changed) to SharedPreferences, read it each time the page is loaded, and set the checked state based on that.
You can use a static variable like is_ticked & set its value true/false when user tick it. and check value of this variable in onCreate() if(is_ticked) set radio button to checked else unchecked .
A question with similar content was asked yesterday:
I have radio button for the user to choose if he/she wants to keep his/her account logged in.
you can't solve this problem just with the layout.xml - you need to save the status of the radio button and load it again once the appropriate activity is started
You could use this:
mListView.setItemChecked(selectedPosition, true);//this will check(enable) the desired radio button.
selectedPosition, you can save using SharedPreferences.
精彩评论