In this video we learn, how we can save a List of custom Objects to Shared Preferences using Google’s GSON Library. For this purpose we will turn the ArrayList …
Nguồn:https://u-os.org/
Xem thêm Bài Viết:
- Hướng dẫn cách lắp anten ngoài trời đúng kỹ thuật, thu sóng khỏe nhất
- Giải đáp bí ẩn Xamarin là gì? Ưu và nhược điểm khi sử dụng Xamarin
- Tuyệt chiêu sửa lỗi window photo viewer can’t open this picture because
- Bộ nhớ đệm là gì? Có nên xóa bộ nhớ đệm trên thiết bị không?
- Bật mí 3 cách chụp ảnh bằng máy tính win 7 dễ như ăn kẹo
* * *
I added a link to the example code into the description box!
* * *
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.project/com.example.project.MainActivity}: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $
Hi there. What to do – if my array of objects is a string array? Changing the arrayList to arrayString won't work :-(?
please give me know the font you are using :p
you are so damn good at making videos!
hi so i did what you said on the video but when i click on the save button the app crashes, in the logcat it says
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.reminded/com.example.reminded.SecondActivity}: java.lang.IllegalArgumentException: class android.widget.Button declares multiple JSON fields named mMinWidth
Exactly what I was looking for. What a simple and elegant solution. Cheers!
If I press back button on an activity is onDestroy() called? if so i when its called i can use this to save data when my activity gets destroyed
Thank you very much for this excellent tutorial. Very simple, very effective 🙂
Thank you so much, this is exactly what I am looking for my app.
I'm not sure Shared Preferences should be used to store big amounts of data, but rather flags and the like. So if your data is too big, use a DB.
your tutorials are different from YouTube 👍🏻
du bist wirklich toll!
du schaffst das immer die Idee in so einer kurzen Zeti sehr deutlich zu erklären!
Ich danke dir vielmals!
nun habe ich eine kleiene Frage bitte: wie kann ich die Daten automatisch speichern (wenn die App gescloßen oder gekillt wird)?
DANKE!!!!!
Thank you so much!
I made my small app for my study at uni, with very few instructions, and your tutorial helped me a lot. THANKS <3<3<3
Thanks more!!!!
Can you tell me how i can do it for 2d arrays ?
Thanks for this tutorial ! is someone know how to do the same thing out of an activity ? I have severals activity and i want to save datas from each one, so a class to save the datas would be easier than to do the same methods each time … Thanks for the time you will take to answer me
Thks alot .
I also saw this in some blog, and i tried to use this example with favorite (button) for each item , save correct but in scrolling recyclerview there are som errors. If u have a video implementing this please link
Thanks buddy, You did a great job. So saved my another day. Thanks
Hello sir can you make a tutorial about arrays with activity in it. Exmple.
Arr[0] = activity1.class
And pass it to next activity
can you make a tutorial explaining recyclerview with AsyncTask with custom adapter
i was trying to use tinydb but failed but this
u have my respect 💕
Thanks a lot for this tutorial
Thank you for help !
Tomatoes hahaha hello again, and thanks for the help.
thank you.. you just did the best
Good
Hey, can you help me? loadData() crash my app… I tried to make it like when I add an item to the list, it also saves it at the same time.
Thank you so much for clear explanation!
I'm trying to figure out something,I hope you can help.
Task:Get data of only all mLine2 strings which we saved.And send all data through bluetooth adaptor.Bluetooth app ready,saving all objects with your way also ready,now I just need to send mLine2 abjects one by one through bluetooth.
Hope you can help 🙂
Your videos are helping me so much, thank you!
I am confused. How can it resolve variable mExampleList if you are not creating it in the beginning?
For me the load function isnt working gson.fromJson(json ,type) allways returns null
This was really great, thank you!