Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6363775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:04:45+00:00 2026-05-25T00:04:45+00:00

When my application starts I need to load about 500 objects from an xml

  • 0

When my application starts I need to load about 500 objects from an xml page, like this:

<object>
<name>objectname</name>
<info>info</info>
<info2>info</info2>
<info3>info</info3>
<info4>info</info4>
<alias>false</alias>
</object>

Now I want to store this on the device, hoping the reading will be faster. Currently I use an ObjectOutputStream to write the objects.

private static void write(ArrayList<MyObject> objects, String fileName, Context context) {
        final File cacheDir = context.getCacheDir();
        final File objectsFile = new File(cacheDir.getAbsoluteFile() + File.separator + fileName);

        FileOutputStream fos = null;
        ObjectOutputStream oos = null;
        boolean keep = true;

        try {
            fos = new FileOutputStream(objectsFile);
            oos = new ObjectOutputStream(fos);

            oos.writeObject(objects);
        } catch (Exception e) {
            e.printStackTrace();
            keep = false;
        } finally {
            try {
                if (oos != null)
                    oos.close();
                if (fos != null)
                    fos.close();
                if (keep == false)
                    objectsFile.delete();
            } catch (Exception e) {
            }
        }
    }

This is not a very fast solution, reading can take about 10-15 seconds. I’m showing the objects in a listview, so all objects need to be read in at once.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:04:45+00:00Added an answer on May 25, 2026 at 12:04 am

    I think the best method to store such data would be in a database (see here).

    Parse once and store the information in the database (one column for each attribute). It should be pretty fast to retrieve 500 records from the database 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my Silverlight application, I load all the images I need at application start
I have an application that when it first starts i need it to run
It seems that when a WPF application starts, nothing has focus. This is really
I have couple resource DLLs that I currently load when application starts using following
I developed an application using a recent Glade, so I need it to load
I need to create a batch file which starts multiple console applications in a
Every time I start working on a new J2EE web application, I need to
When a java based application starts to misbehave on a windows machine, you want
I'm getting an error when my application starts. It appears to be after it's
I've written a Autoit script that starts a GUI application, when the application starts

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.