Search code examples
androidtwitterbundleserializable

How to insert non-parceable and non-serializable object into Bundle


I'm using the twitter API for android. From a call, a List of 'Tweet' objects is returned. I want to save this list into my savedInstanceBundle when required so I don't have to make the large http call again. The problem is that 'Tweet' does not implement parceable or serializable so I cant input it into the bundle.

What are my options?

Call<List<Tweet>> lookup = apiclient.getStatusesService().lookup(ids, true, false, false);

lookup.enqueue(new Callback<List<Tweet>>() {
        @Override
        public void success(Result<List<Tweet>> result) {
            Response response = result.response;
            List<Tweet> tweets = result.data; //what I'd like to save
        }

Solution

  • You can't. All you can do is take the information from it, create your own object that is Parcelable or Serializable, and send that.