lundi 25 mai 2015

can i use sharedpreference in an other activity of my app

Have a good day. I want to set up shared preference activity.I have desined a dialog activity but if i save pref there can i take the pref from an other activity of my app.

@Override
public void pref(){

    SharedPreferences sharedpref =getSharedPreferences("BOYUT",Context.MODE_APPEND);
                        sharedpref=getSharedPreferences("THEME",Context.MODE_APPEND);
    SharedPreferences.Editor editor= sharedpref.edit();
     editor.putInt("BOYUT", sonboyut);
     editor.putInt("THEME",tema);
     editor.apply();
    Toast.makeText(getApplicationContext(),"Kaydedildi",Toast.LENGTH_LONG).show();

}

Aucun commentaire:

Enregistrer un commentaire