Hi,

I have two problems after having broken up my rather large MIDlet into a minimal MIDlet and several Classes.
One of the classes (A) is the Settings Class where the Settings DB (Recordstore) is meant to be the "server" class for several parameters to the rest of the Classes.
The A class works perfectly when I use its internal methods from within the class.
However, I cannot get it to work when I try to call the methods from the other Classes.
I cannot find any documentation on how to do this, so I kindly ask for support.

SIMPIFIED EXAMPLE
*****************

// MIDlet
//*******
public class myMIDlet extends MIDlet implemets CommandListener{
public A a;
public B b;

startApp(){
a = new A(this);
a.readParameters(); // Try to make sure that the Record store is read and local parameters is set.

b = new B(this);

startMainMenu;
}

}// myMIDlet


// Class A , the Server class
//***************************
public class A{
public MIDlet midlet;
public B b;

Param1;

public A(MIDlet midlet){
this.midlet = midlet
}

readParameters(){
...
}

storeParameters(){
...
}

// Setters & Getters
//*******************
public String getparam1(){
return Param1;
}

public void setParam1(String par1){
param1 = par1;
}
.
.
} //A


// Class B , one of several User classes (GUI, Comms, Loc, etc.)
//**************************************************************
public class B implements runnable{
public MIDlet midlet;
public A a;

Alert alertUser;
String Param1 = null;

// Own B constructor
public B(MIDlet midlet){
this.midlet = midlet
}

// Constructor for A
if(a == null){
a = new A(midlet);
}

public ActionMethod(){
a.readParameters(); // Try to make sure the parameters are set from Rec store
new Thread(this).start(); // Is this command correct? Runnable will use communication.
}

run{
try{
Param1 = a.getparam1(); <--- Problem 1
}
catch (Exception ex) {
alertUser = new Alert("ClassB, Param1 read error: ", ex.toString(),null,null);
alertUser.setTimeout(4000);
alertUser.setType(ERROR);
Display.getDisplay(midlet).setCurrent(alertUser);
}

if (Param1.length() < 1){
alertUser = new Alert("ClassB, read error: ", "Param1 is missing" ,null,null);
alertUser.setTimeout(3000);
alertUser.setType(ERROR);
Display.getDisplay(midlet).setCurrent(alertUser); <--- Problem 2
}

} //run

} //B



Problem 1:
The call to get Param1 doesn't work.
The call fail. Even when using the debugger I cannot find out what's wrong.
I have also placed a try/catch harness around the "Param1 = a.getparam1()" call.
Strangely nothing ends up there. Or rather the alertUser Alert do not result in any message displayed.

Problem 2:
None of the two alertUser Alerts are called.


Greatful for hints on what causes these problems.
/Per