السلام عليكم ورحمة الله وبركاته
أود أن أعرف كيف أضيف thread لهذا الكود ..
public void commandAction(Command command, Displayable displayable) {
// write pre-action user code here
if (displayable == SplashScreen) {
if (command == SplashScreen.DISMISS_COMMAND) {
// write pre-action user code here
switchDisplayable(null, getMenu());
// write post-action user code here
}
} else if (displayable == ThankEnd) {
if (command == exitCommand) {
// write pre-action user code here
exitMIDlet();
// write post-action user code here
}
} else if (displayable == info) {
if (command == Submit) {
try{
customer newCustomer = new customer();
//newCustomer.setCustomerorder(foodListMessage);
//NewWebServiceService_Stub s = new NewWebServiceService_Stub();
String sname = textField1.getString();
String sphone = textField2.getString();
String splace = textField3.getString();
// s.addCustomer(sname);
newCustomer.setCustomerorder(sname);
newCustomer.setCustomerorder(sphone);
newCustomer.setCustomerorder(splace);
//String o = foodStub.addCustomer(sname);
//newCustomer.setPlace(foodListMessage);
boolean test = foodStub.addCustomer(newCustomer);
// System.out.print(test);
} catch (RemoteException ex) {
ex.printStackTrace();
}
switchDisplayable(null, getThankEnd());
// write post-action user code here
} else if (command == backCommand2) {
// write pre-action user code here
switchDisplayable(null, getMenu());
// write post-action user code here
}
} else if (displayable == menu) {
if (command == cancelCommand) {
// write pre-action user code here
exitMIDlet();
// write post-action user code here
} else if (command == okCommand) {
// write pre-action user code here
System.out.println("hello");
ChoiceGroup cg = (ChoiceGroup) menu.get(0);
boolean[] bb = new boolean[cg.size()];
cg.getSelectedFlags(bb);
for (int i = 0; i < cg.size(); i++) {
System.out.println(cg.getString(i) + bb);
/*if (bb == true) {
try {
customer newCustomer = new customer();
newCustomer.setCustomerorder(foodListMessage);
String sname = textField1.getString();
String sphone = textField2.getString();
String splace = textField3.getString();
newCustomer.setName(sname);
newCustomer.setPhone(sphone);
newCustomer.setPlace(splace);
//newCustomer.setPlace(foodListMessage);
boolean test = foodStub.addCustomer(newCustomer);
} catch (RemoteException ex) {
ex.printStackTrace();
}
}*/
}
switchDisplayable(null, getInfo());
// write post-action user code here
}
} else if (displayable == order) {
if (command == List.SELECT_COMMAND) {
// write pre-action user code here
orderAction();
// write post-action user code here
} else if (command == backCommand1) {
// write pre-action user code here
// write post-action user code here
} else if (command == okCommand2) {
// write pre-action user code here
// write post-action user code here
}
} else if (displayable == waitScreen) {
if (command == WaitScreen.FAILURE_COMMAND) {
// write pre-action user code here
// write post-action user code here
} else if (command == WaitScreen.SUCCESS_COMMAND) {
// write pre-action user code here
switchDisplayable(null, getMenu());
// write post-action user code here
}
}
// write post-action user code here
}