I wrote a code snippet that change the background color of the LinearLayout by selecting some RadioButtons , the main color of the layout is white , but I want to keep one of these RadioButtons(their color) for always when it is checked , but usually after closing the APP it turns to the main color. how can I use shared preference for this?
My .java file:`
public class Setting extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.setting);
        final LinearLayout ll=(LinearLayout) findViewById(R.id.LinearLayout);
        final RadioButton radio_red = (RadioButton) findViewById(R.id.radio_red);
        final RadioButton radio_yellow = (RadioButton) findViewById(R.id.radio_yellow);
        radio_red.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                ll.setBackgroundColor(Color.RED);
            }
        });
        radio_yellow.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                ll.setBackgroundColor(Color.YELLOW);
            }
        });
    }
}
`
 
     
     
    