Pessoal,
Tenho uma midlet com vários comandos, entre eles, o especificado abaixo que precisa fazer uma conexão com o servidor, com isso eu preciso criar uma thread para ele fazer essa conexão.
O que está abaixo do t1.start, para executar, antes eu preciso receber uma resposta do servidor se deu tudo certo a conexão e só depois continuar, como poderia fazer isso de modo eficiente?
else if (arg0 == register){
stateControl t1 = new stateControl("teste");
t1.setState(stateVerify());
t1.setRegisterData(nickName.getString(), name.getString(), country.getString(), email.getString());
t1.start();
try {
String data1 = nickName.getString();
openRecStore();
writeNickName(data1);
readNickName();
closeRecStore();
} catch (Exception e) {
db(e.toString());
}
}
Este é o run da thread t1:
stub.createPlayer(this.nickName, this.name, this.country, this.email): retorna true ou false.
public void run() {
if(getState().equals("Anonimo")) {
try{
ChessPort_Stub stub = new ChessPort_Stub();
stub.createPlayer(this.nickName, this.name, this.country, this.email);
} catch (RemoteException rse) {
rse.printStackTrace();
}
}
}
Se precisarem de mais detalhes me avisem.
Obrigado.