I am working on an android app and I ask the user a question at first. Lets say male or female.. My app has two different parts, one is for men one is for women. If the user chooses "male", I open the activity for men. I put a checkbox to remember this choice for next time. And when the user opens the app next time I dont want to ask again, just open the activity for men.
I hope it is clear. Here is code piece of related part:
View checkBoxView = View.inflate(this, R.layout.activity_menu, null);
CheckBox checkBox = (CheckBox) checkBoxView.findViewById(R.id.checkbox);
checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// Shared preferences.
}
});
checkBox.setText("Bu kararımı sonraki girişlerde hatırla.");
Can you give me some inspiration? I checked ome questions and articles but I couldnt find an example such as mine.
Thanks in advance.