Today we will learn how to use Shared Preferences in Android to store data. We will use a SharedPreferences.Editor to save Strings and Booleans, but you can …
Tag: sharedpreferences android, [vid_tags]
Xem Thêm Bài Viết Về Mẹo Hay Khác: https://meocongnghe.vn/meo-hay
Nguồn: https://meocongnghe.vn

Previous Post
Lập trình Android A-Z – Bài 95: Shared Preferences
* * *
I added a link to the code for this video into the description!
* * *
Your tutorials are really clear, thank you
Thank you for the help! You are the go-to man for android studio.
oh thank you bro.i'm learned shared preferences now
Thanks so much for the video, it was helpful coding flow but i gat a little problem with the code, when i back press to leave the page to the firestore ui recyclerview and click the same information again to view if the change remain constant .. it doesnt stay the same. please please check !!!!!!!!!!!! thanks
public void SaveData() {
SharedPreferences sharedPreferences = getSharedPreferences(SHARED_PREFS, MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean(BUTTON_CHANGE, UnprocessAndProcessed.isEnabled());
editor.apply();
Toast.makeText(this, "data saved", Toast.LENGTH_SHORT).show();
buttonOnOff = sharedPreferences.getBoolean(BUTTON_CHANGE, false);
if (UnprocessAndProcessed.isEnabled()){
UnprocessAndProcessed.setEnabled(false);
UnprocessAndProcessed.setText("processed");
}else{
UnprocessAndProcessed.setEnabled(buttonOnOff);
}
}
Works! Thanks
Thanks, it works now. I used "Preferences" before instead of "SharedPreferences" and it didn't work … just changed the name and passed the name of the SharedPrefs and now it works!
U are robust
please do a stringSet one
Thanks it works!!
make more videos…it really helped me in my app…your explainations really helped me in getting though the codes
Why we use final variable here and we change value of final variable using putString method?????
You are very good in android studio!
Important start at 04:50
And can that data be reset at the end of the day? Thanks
Es ist verrückt wieviel Aufwand du in diese Videos steckst! Und trotzdem alles gratis… 😮
Bin dir sehr dankbar!
Can you create a video on how to save data from button click in Excel using apache poi or other libraries
Using this, can I save documents locally and save to firebase after the user clicks sync …?
it worked. thank u soo much for this.
nobody:
java: Creating instances: sharedpreferences sharedpreferences = getsharedpreferences (shared prefs)
May I know what is the best way to store seekbar progress for each audio chapter . I am making an audiobook but I want it to save the position for every chapter of that book being played. I am using ExoPlayer library. Do I use sharedpreferences? But if I do, how will I be able to store multiple positions depending on what chapter it plays?
I really like how your video zooms in on the code as it really makes me not get distracted by the other codes as I learn. Can you make video about caching please?
Nice , thanks
Thank you. Great Tutorial