android how to keep large List<String[]> while application runs

Viewed 889

What is the best way to keep a List<String[]> while my application runs? I am having problems with my approach. It most of the time gives me an OutOfMemory Error since the list is too big.

The List<String[]> is the result of parsing a csv file that I have downloaded online. What I do is parse the csv in an activity then save its result in a static class member like:

String url = "http://xxx/pdf/pms/pms_test.csv";
try {
    InputStream input = new URL(url).openStream();
    CSVReader reader = new CSVReader(new InputStreamReader(input));
    SchedController.sched = reader.readAll();
    input.close();
} 

...then access ClassName.sched on different activities.

I am doing this so that the parsed data will be available in every activity... And I don't have to parse again. What can I do to improve it?

2 Answers
Related