Passing large text-data through intent. How to cache it?

282 views Asked by At

I'm passing some data to DatabaseService through an Intent. However there is a corner case of one user when this data is really huuuge. And I get

E/JavaBinder: !!! FAILED BINDER TRANSACTION !!!

Bummer.

Normally people assume that I try to pass a bitmap to (though?) a LruCache. Okay, can I use if for like an array list of objects? As I said - in fact this is a response from server, which is a JSON.

Any ideas how to solve this? Is there a special class for this that I'm not aware of?

1

There are 1 answers

0
PEHLAJ On

Option 1. Store json data in db and then access data from db in your activity

Option 2. Store data in a centralized object (singleton etc) & then access that object in Activity.

Let say you have a single class AppData. Store data in AppData. Access data using AppData in your activity directly.

Option 3. Parse json to corresponding entities/models, make them Parcelable, then Store parcelable data in preference.

How to make entity parcelable with just copy paste