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 8041131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:06:59+00:00 2026-06-05T04:06:59+00:00

I have this class: public class SaveState implements Serializable { private static final long

  • 0

I have this class:

public class SaveState implements Serializable {
    private static final long serialVersionUID = 1L;
    public List<String> downloadedMagazinesIds = new ArrayList<String>();//id's de revistas descargadas
    public List<String> downloadedMagazinesSummaries = new ArrayList<String>();//página sumario de cada magazine
    public List<FullMagazine> downloadedMagazines = new ArrayList<FullMagazine>();//todos los magazines bajados
    public Magazines ms=null; //Esta clase contiene el array de previews de revistas generado con el parser de XML
}

And I use these methods to store the class (SaveState object) in the sdcard and to read the object from the file into an object again:

public static void saveData(){
    ObjectOutput out;
    try {
        //primero comprobamos si existe el directorio, y si no, lo creamos.
        File folder = new File(Environment.getExternalStorageDirectory() + "/C/");
        if(!folder.exists())
            folder.mkdirs();

        File outFile = new File(Environment.getExternalStorageDirectory(), "/C/appSaveState.data");
        out = new ObjectOutputStream(new FileOutputStream(outFile)); 
        out.writeObject(saveState);
        out.close();
    } catch (Exception e) {e.printStackTrace();}
}


public static void loadData(){
    ObjectInput in;
    try {
        File inFile = new File(Environment.getExternalStorageDirectory(), "/C/appSaveState.data");
        in = new ObjectInputStream(new FileInputStream(inFile));        
        saveState=(SaveState) in.readObject();
        in.close();
    } catch (Exception e) {e.printStackTrace();}
}

I store the object and each time my app is closed and I read the object from the sdcard each time my app is opened and it works fine. The problem comes when I created a newer version of my app (1.01). When I start the app and I try to read the file from the sdcard the file is read but all the variables of the object class are empty, and they are really not empty.

Why doesn’t my code work properly? What should I do to fix it?

  • 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-06-05T04:07:01+00:00Added an answer on June 5, 2026 at 4:07 am

    I have attempted to edit your question to make it more readable and understandable. Hopefully it will help you get some good answers.

    I suggest the following

    1. Try to read it using the same version 1.0. This will eliminate any “version” / manifest related issues.
    2. Your FullMagazine may be the root cause, remove that object and try it again.

    Let me know what you find. It is a interesting question.

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

Sidebar

Related Questions

I have this class public class wordObject implements java.io.Serializable { String wordName; int occCount;
I have this class: public class Friend { private String name; private String location;
I have this class: public static class CsvWriter { private static StreamWriter _writer =
I have this class: public class UploadFile : INotifyPropertyChanged { private string name; public
I have this class: public class docInfo { private int freq; private HashMap<String, Double>
I have this class: public class Statistics { List<string> _lsit; public List<string> ipList {
I have this simple class: public class LuceneUtil{ private final EntityManager entityManager; public LuceneUtil()
I have this class: public class CompositeSecurityAuthorizer implements SecurityAuthorizer { @inject @CompositeSecurityAuthorizerAnnot List<SecurityAuthorizer> authorizers;
Suppose I have this class: public class DispatcherService<T> { private static Action<T> Dispatcher; public
I have this class: public class Test { public static void main(String[] args) {

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.