0

I have a ListView where each item is made of multiple TextViews and Bitmaps. The list is quite large and it takes around 5-6 seconds to load when the app is launched. So, I'm trying to cache the ListView data into my SD card, so that the list is created only once and after that, the app would read the list from cache, instead of creating the list all over again (I'm using AsyncTask).

So, I tried caching ListView data as simple Serializable object, using FileOutPutStream and ObjectOutputStream. This works fine for simple lists, but in my case, I'm unable to read data from cache. The stack trace says the object couldn't be read as it is not Serializable. How can I store such complex ListView data? I have tried this so far.

Community
  • 1
  • 1
Vinit Shandilya
  • 1,643
  • 5
  • 24
  • 44
  • use UIL ( universal image loader ) and enable cache saving on disk, easy use and very powerful library – Shayan Pourvatan Dec 25 '14 at 10:52
  • It would be easier for us to determine how to improve your performance if you posted your adapter code, and how you load your current data. – Ifrit Dec 25 '14 at 12:04

1 Answers1

0

You may have done this, but it's not clear as I can't see your code: You have to extend extend Serializable in your custom ListView, and you'll likely need to set and explicity serialVersionUID (at least I did):

public class ListView implements Serializable {


    /**
     * 
     */
    private static final long serialVersionUID = 21;
JASON G PETERSON
  • 2,193
  • 1
  • 18
  • 19