I've continued to try and figure out what's wrong. It seems to be having trouble storing the Category object. As written, I'm creating a Vector of Transactions and then attempting to store the Vector.
When I changed it to a Vector of STRINGS, it gave no errors.
So then I created a new EXTREMELY SIMPLE class and tried persisting a Vector of this new class.
Here's the new class:
Code:
class Test implements Persistable{
boolean _tst;
public Test(boolean TST){
_tst = TST;
}
}
Here's my new test code. I thought I could persist a Vector of custom objects.
Code:
import java.util.Vector;
import java.lang.String;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.MenuItem;
import net.rim.device.api.system.*;
import net.rim.device.api.util.Persistable;
import net.rim.device.api.system.PersistentObject;
import net.rim.device.api.system.PersistentStore;
class Test implements Persistable{
boolean _tst;
public Test(boolean TST){
_tst = TST;
}
}
class CashBoxApp extends UiApplication
{
static Vector Transactions;
long KEY = 0xa3b3159378f59a29L;
static PersistentObject persistTransactions;
{
persistTransactions = PersistentStore.getPersistentObject( KEY );
Transactions = (Vector) persistTransactions.getContents();
if( Transactions == null ) {
Transactions = new Vector();
persistTransactions.setContents( Transactions );
persistTransactions.commit();
}
}
static void addTransaction(Test a){
Transactions.addElement(a);
persistTransactions.commit();
}
public static void main(String[] args){
addTransaction(new Test(true));
CashBoxApp app = new CashBoxApp();
app.enterEventDispatcher();
}
CashBoxApp(){
// Build the screen.
MainScreen AcctListScreen = new MainScreen();
pushScreen(AcctListScreen);
}
}
Edit: My comment about thinking that I could Persist custom objects got me to thinking that I had read something about "Persistable" so I did some checking and added the portion that's in
RED above--STILL get teh same errors.