I'm new here. I'm french so maybe my english is not very good, sorry for that.
I'm a beginner in Android development, I got to create an app for finish my study.
I explain to u my problem : I have on an activity called VoeuxActivity.java 8 buttons, they are all VISIBLEs at the beginning, when an user click on one of them button change by INVISIBLE (user can't see the button after clicked on it), I have no problem for do that. But my problem is when I quit the app and I come back again on my app, the button is visible again, so there's no save on my app. I think I got to use SharedPreferences but I really don't know how to use that. If someone can help me, I will be very happy. I post a court code with one button and the text above the button (because the button is an image in background). I make the TextView INVISIBLE too and I want to save the changement too.
public class VoeuxActivity extends Activity {
public static boolean isClicked = false;
Button totoB;
TextView totoTv;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_voeux);
totoB = (Button) findViewById(R.id.perso1);
totoTV = (TextView) findViewById(R.id.perso1Text);
totoB.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
isClicked = true;
totoB.setVisibility(View.INVISIBLE);
totoTv.setVisibility(View.INVISIBLE);
Intent intentToto = new Intent(VoeuxActivity.this, JouerActivity.class);
startActivity(intentToto);
}
});
} }
How can I save the changement of the Button and the TextView from Visible to Invisible?
Thank u for yo help. Giggs