SharedPreferences - How to Save & Retrieve Data Android Studio | Beginner's Guide

Поделиться
HTML-код
  • Опубликовано: 19 июн 2024
  • Hello fellow Android Developers! Today I will show you how to use Shared Preferences in Android to store data. We will be using a SharedPreferences.Editor to save multiple String values, but keep in mind that you can also save other data types like Integers, Floats, Booleans or Long variables.
    This tutorial is suitable for beginners, and I take you step by step through the whole process :)
    Any questions? Feel free to ask below!
    Some Keywords for easy navigation for newbies:
    android developer website
    how to android development
    android os application
    splash screen android example
    android splash screen
    splash page website
    what is the newest android os
    Keywords:
    how to make splash screen
    how to make splash screen android
    android splash screen
    splash screen in android studio
    android studio
    splash screen using android studio
    splash screen in android app
    android studio
    android xml design
    xml animation
    android gui
    xml design
    splash screen
    transition android
    material design
    smooth splash screen
    Hope you enjoyed the tutorial!
    Don't forget to subscribe :)
  • НаукаНаука

Комментарии • 86

  • @Ben_obrien
    @Ben_obrien  4 года назад +12

    If you guys have any requests on what tutorials you want to see, just leave a comment below! Thanks for watching :)

    • @lakshmikanthgangaramaiah5249
      @lakshmikanthgangaramaiah5249 3 года назад

      Could u please use this concept to save the checkbox checked? please make a video on that

    • @thevass3797
      @thevass3797 3 года назад

      @@lakshmikanthgangaramaiah5249 you can check if the checkbox is checked and when it is checked you can put the shared preference code in it. Simple as that.

    • @ishitaagrawal6848
      @ishitaagrawal6848 3 года назад

      Please checkout the CS50's android Pokdex project. I have been stuck on it since 1 week and I just don't understand from the documentation. Please make a tutorial on that !!!!!

    • @crunchraven000
      @crunchraven000 2 года назад

      Hello dear friend. Do you have any tutorial on how i can have preferences by user? i am using xampp to store the users in users table, then i want another table for lets say results, so a signed in user can choose from 1 to 5 and got stored to the table results by user id

    • @samrad6508
      @samrad6508 2 года назад

      @@lakshmikanthgangaramaiah5249 did you know how to do it ?

  • @shahinjamader9121
    @shahinjamader9121 2 месяца назад +1

    Thank you so much, Sir!
    Your tutorial save my another 6 hour.

  • @superrv0023
    @superrv0023 3 года назад +5

    Thank you so much. I have been searching about this for days😭😭

  • @gp552
    @gp552 3 года назад +2

    Thank you for this video and for gracefully teaching me what the android docs couldn't

  • @saqibmasood6778
    @saqibmasood6778 3 года назад +7

    A good tutorial, explaining both read and write on different activities, which is rare. Thanks a lot.
    Also just to make it simpler for us newbies you may add a new activity 'OtherPage' from the conetxt menu rather than the process you adopted.

  • @Julia-us5wv
    @Julia-us5wv 3 года назад +1

    It's really clear the way you explain and it's useful for me. Thanks !!

  • @immortalgaming617
    @immortalgaming617 2 года назад

    Thank you bro... Best tutor n tutorial on Shared Preference.... exactly what I looked for my Sms forward app! Thanks a ton

  • @StinkyDurian
    @StinkyDurian 2 года назад

    Thank you so much for the clear and easy to understand instructions :)

  • @felixwong4992
    @felixwong4992 3 года назад

    Thank you. I'm still learning and it was helpful!❤

  • @swalloich
    @swalloich 3 года назад

    I scoured documentation, and stack overflow posts with little results. This video helped tremendously, thanks m8.

  • @EvycClips
    @EvycClips 4 года назад +5

    great video for understandable a share preferences in android studio keep it up :)

  • @le0nz
    @le0nz 3 года назад +7

    You are the OG, Thanks for this tutorial!

  • @arkasaha2156
    @arkasaha2156 3 года назад

    Just needed this 😀
    ❤️❤️
    Thanks.🙏

  • @venuskandas1235
    @venuskandas1235 3 года назад

    Very helpful , looking forward to more of your videos!!!!!

  • @JarJarBricks01
    @JarJarBricks01 2 года назад

    You saved my life man. Many thanks!

  • @salmaxxiii5033
    @salmaxxiii5033 4 года назад +3

    this was very helpful, thank you ♥

  • @psalmyjoygelacio6278
    @psalmyjoygelacio6278 Год назад +1

    Old Video Still saved me from due date of my thesis! Super Thank You

  • @GurpreetSingh-kd4hi
    @GurpreetSingh-kd4hi 2 года назад

    This video is awesome, liked and subscribed !

  • @user-ht4ep6td4x
    @user-ht4ep6td4x 2 года назад

    I really loved your explanation!!!!!!!! Please make moreeee!

  • @dubstick4335
    @dubstick4335 3 года назад +1

    Hi man, nice video! I got one question tho. Is there a way that the value on the next page changes whenever the user fills in a new value? Now it only saves the first one.

  • @gulednur5674
    @gulednur5674 Год назад

    Thank you, your video was very helpful

  • @AliFX
    @AliFX 3 года назад

    Awesome video man really great for api token authentication!!

  • @KasGikes420
    @KasGikes420 3 года назад +2

    my right ear really enjoyed this video

  • @sahithdandakadiyala7080
    @sahithdandakadiyala7080 3 года назад

    Great work buddy, you deserve more subs.

  • @lowblowjimboy
    @lowblowjimboy 2 года назад

    You are AWESOMEMOUS!!! Thank You!

  • @wellingtonrocha6802
    @wellingtonrocha6802 2 года назад

    perfect tutorial!! Thanks!!

  • @ashishkumar-eo1tz
    @ashishkumar-eo1tz 2 года назад

    Thanks buddy you made my day

  • @carlosaguirre746
    @carlosaguirre746 2 года назад

    Thanks!! It's so userful!! 😁

  • @pervyshrimp2860
    @pervyshrimp2860 3 года назад

    dude you saved me thank you so much

  • @virusehwag9562
    @virusehwag9562 3 года назад

    Very nice explanation brother
    Thank you.

  • @thedumbestdoge881
    @thedumbestdoge881 2 года назад +1

    What pisses me off about this video is you taught me in just over 8 minutes what I have been trying to acquire from my professor for 2+ days and spending thousands of dollars for. Thank you.

  • @danmanning2006
    @danmanning2006 2 года назад

    very useful, thank you!

  • @bradcheng1203
    @bradcheng1203 2 года назад

    Thanks for your videos.

  • @vasilbtg
    @vasilbtg 3 года назад

    You deserve more subs!

  • @Hugo-jr8im
    @Hugo-jr8im 3 года назад +1

    My right ear liked this video

  • @Defense89
    @Defense89 3 года назад

    awesome tutorial , how can we read all saved stuff ? i have a tic tac toe project to do , first page is a choose player list and an option to add a player , each player score are saved on shared preference, you then must choose an image to play tic tac toe default are X and O. finnaly once the 2 player has chose , tic tac toe game can start. when a player wins scores are updated on shared preferences. but how do you read all shared preference and show them as a choice to click.

  • @nikuzair3178
    @nikuzair3178 3 года назад

    THANK YOU SO MUCH!!!!!!!

  • @leultaye7028
    @leultaye7028 2 года назад

    Thanks Ben!!!

  • @roshanbhamarefoodvlogs
    @roshanbhamarefoodvlogs Год назад

    thank you Sir😇

  • @abhirampuranik228
    @abhirampuranik228 3 года назад

    Thanks :)

  • @randy4ii411
    @randy4ii411 2 года назад

    Thank you sir

  • @goobar
    @goobar 4 года назад

    Nice work 👍👍

  • @crunchraven000
    @crunchraven000 2 года назад

    Hello dear friend. Do you have any tutorial on how i can have preferences by user? i am using xampp to store the users in users table, then i want another table for lets say results, so a signed in user can choose from 1 to 5 and got stored to the table results by user id

  • @mr.RAND5584
    @mr.RAND5584 2 года назад

    Can we put the sharedpreferences in a list? Or an array.

  • @ayurisqi3481
    @ayurisqi3481 3 года назад

    Thank you

  • @scuzzoo
    @scuzzoo Год назад

    Is there a way to save onto the shared preference without having the button, like once we put data into the field, it would just stay there automatically?

  • @subramanianchenniappan4059
    @subramanianchenniappan4059 3 года назад

    Thanks bro

  • @harishlodha8794
    @harishlodha8794 2 года назад

    Sir background video recorder app can store user record video....

  • @XandarLake1
    @XandarLake1 3 года назад

    Hi, is there a way to store those data after APP is close and once it gets open again we still have the same data written. Thnx.

  • @romualdgrandin
    @romualdgrandin 2 года назад

    Thanks you for this tutorial.. Do you can to help me for an example with to getInt() and putInt() please ;)

  • @shortmoviecut
    @shortmoviecut 3 года назад

    In RecyclerView there is a cardView and in it, there are multiple checkBoxes. If i select and leave app and come back to app again, those selected checkBoxes must be selected. Can you help me with that bro?

  • @pakblogger6025
    @pakblogger6025 3 года назад

    Can you make shared preferences Part 2 because the input you printed on otherpage.xml will always show there unless you enter the new values... and by clicking on save button it should show us the values we saved... the video was quite easy to understand

    • @stevenmaina2904
      @stevenmaina2904 3 года назад

      do you have a tutorial on finding the number of records after adding a new column in sugar orm, kindly help.

  • @pakblogger6025
    @pakblogger6025 3 года назад

    and also tell us how to delete and update the values we saved
    Much appreciated...

  • @zakiewatin3219
    @zakiewatin3219 3 года назад +1

    SharedPreferences are loading my default value instead of saved value. I have everything correct. My SharedPrefs save properly in one activity, but the values don't save at all in other activities.

  • @bootcamp7492
    @bootcamp7492 2 года назад

    i have doubt which language you have used like kotlin or java cause i am a new learner

  • @jupiterx294
    @jupiterx294 3 года назад +1

    Thanks for the vid. If we restart the app will the name still be there if now can you tell me how to do that?

    • @aswing1480
      @aswing1480 3 года назад

      It will be saved even after the app is closed

  • @iamgroks
    @iamgroks Год назад

    Yo man. The guide is good, but I have a problem. Android studio shows that there are zero errors in the code, but when I run the app I get a crash. Can you help me with this?

  • @hunsendrake2535
    @hunsendrake2535 7 месяцев назад

    is this working on a multiple data?

  • @budyfriend_code
    @budyfriend_code 4 года назад +1

    very good

    • @Ben_obrien
      @Ben_obrien  4 года назад

      Thanks man, much appreciated 😊 subscribe for more!

  • @aayushmishra675
    @aayushmishra675 3 года назад +2

    left ear: am i joke to you?

  • @good114
    @good114 Год назад

    💕❤️

  • @woonie3134
    @woonie3134 3 года назад

    How can we edit after we saved??

  • @kamekazekwago874
    @kamekazekwago874 Год назад

    why do i not have the function getText()

  • @YourUnityhelper
    @YourUnityhelper Год назад

    its just like player prefs in unity

  • @hemant.r3499
    @hemant.r3499 Год назад

    Not working application is crashing

  • @87nehal
    @87nehal 3 года назад

    Not working everytime gives default value

  • @LetrixAR
    @LetrixAR 3 года назад +3

    My left ear is jealous

    • @mryup6100
      @mryup6100 2 года назад

      same, they are thinking of leaving me

  • @tm1
    @tm1 3 года назад +1

    It's not working man it shows shared preference app stopped working

  • @uttu_aka_freakyallahabad6406
    @uttu_aka_freakyallahabad6406 4 года назад

    Actually I am new and I want to make social media app can you please help me out

  • @MrCode1
    @MrCode1 4 года назад

    Made a video about encrypted shared preferences, check it out :)

    • @Ben_obrien
      @Ben_obrien  4 года назад

      Will do! Excited to see it