2

I have a problem that, I have a webservice which returns 3 arrays from JSON response. I want to persist those lists from one class to another in our android app with the help of Serializable interface and Setter and Getter Methods. But I don't know how to achieve this? Please help me out about this problem.

Thanks in advance

1 Answer 1

2

SharedPreferences or Sqlite can be the way you can use to store persist data.

You can use SharedPreferences for persist data between Activities.

Some examples for Shared Preferences

Example1

Example 2

Some examples for Sqlite

Example 1

Example 2

Example 3

Sign up to request clarification or add additional context in comments.

5 Comments

I want to persist data in our app not to pass data from one activity to another. Can you give me the idea about persisting data without static variables?
You can use SharedPreferences for persist data between Activity or Sqlite also.
Sqlite also is a good option check the links that I had provided.
I can not use Sqlite because this is my restriction. Can give me the idea behind the Serializable class and how to make that with arraylists for setting and getting the desired values.
In Android you can use Parcelable instead of Serealizable that I opted you before.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.