Jump to content
McObject Forums

Search the Community

Showing results for tags 'data lost'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • McObject Embedded Databases
    • Perst
  • Root2


  • Steven Graves' Blog


  • Community Calendar

Found 1 result

  1. NO DATA when open DB

    Hello, i want to try to use perstdb inside an android app, but first I have to test if it is good for my case. Therefore I write one Testapp. Now I have a problem. I write a class called "PerstDataManager" which is used to interact with the db. My Problem is always when i call the constructor of these class I lost all data. When I call the constructor I can write and read from the database. But with the next start of the App I have to call the constructor again, and then the whole Data is lost. I think I make something wrong inside the code of my constructor. public PerstDataManager(Context ApplicationContext) { this.ApplicationContext = ApplicationContext; String Filepath = this.ApplicationContext.getFilesDir().getAbsolutePath(); // Get instance of Perst storage db = StorageFactory.getInstance().createStorage(); // Open the database with given database name and spacified page pool (database cache) size db.open(Filepath+"/" + databaseName, pagePoolSize); // There is one root object in the database. root = (PerstRootClass)db.getRoot(); if (root == null) { Log.i(MainActivity.LogTag, "root == null"); //Toast.makeText(this.ApplicationContext, "root Object is null", Toast.LENGTH_LONG).show(); // if root object was not specified, then storage is not yet initialized // Perform initialization: root = new PerstRootClass(db);// ... create root object // and register new root object db.setRoot(root); } //Toast.makeText(this.ApplicationContext, "Objects stored:" + (root.intKeyIndex.size()), Toast.LENGTH_SHORT).show(); } Can somebody help me to find my mistake? I will attach the whole class at this post. PerstDataManager.java