Ola turma to com uma duvida básica em j2me
Criei meu 1 midlet rubrica, mas não consigo criar o ciclo de repetição,
ou seja vc entra no screenMenu() seleciona Insert ,depois seleciona o command back e o screenMenu() volta novamente mas não consigo repetir as ações novamente!!
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.io.*;
import java.util.Vector;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class TraveList extends MIDlet implements CommandListener {
private List mList;
private Display display;
private Command cmdExit,cmdAdd,cmdBack,cmdSelect;
private Form entryScr;
private TextField text_name,text_endereco,text_phone,text_email;
private Vector vectorrecords;
public TraveList() {
vectorrecords=new VectorRecords();
cmdBack= new Command("Back", Command.EXIT, 0);
cmdAdd= new Command("Add", Command.EXIT, 0);
cmdExit= new Command("Exit", Command.EXIT, 0);
cmdSelect= new Command("Select", Command.EXIT, 0);
text_name=new TextField(" Name","",10,TextField.ANY);
text_phone=new TextField("Phone","",10,TextField.ANY);
text_endereco=new TextField("Address","",30,TextField.ANY);
text_email=new TextField("email","",30,TextField.ANY);
}
private void screenMenu(){
String[] stringElements = { "Insert", "Search", "Remove" };
mList = new List("menu", List.IMPLICIT, stringElements,null);
mList.addCommand(cmdExit);
mList.addCommand(cmdSelect);
mList.setCommandListener(this);
display=Display.getDisplay(this);
display.setCurrent(mList);
}
private void screenDadosPessoais(){
if(entryScr == null){
entryScr=new Form("Por favor digite seus dados");
entryScr.addCommand(cmdBack);
entryScr.addCommand(cmdAdd);
entryScr.append(text_name);
entryScr.append(text_phone);
entryScr.append(text_email);
entryScr.append(text_endereco);
entryScr.setCommandListener(this);
Display.getDisplay(this).setCurrent(entryScr);
}
}
public void startApp() {
screenMenu();//inicializa o menu com a lista
}
public void addVectorRecords(){
VectorRecords vect_novo=new VectorRecords();
vectorrecords.addElement(vect_novo);
}
public void commandAction(Command c, Displayable s) {
if ( c == List.SELECT_COMMAND) {
int index = mList.getSelectedIndex();
if(index == 0){
screenDadosPessoais();//só funciona uma véz
}
}
if(c == cmdBack ){
screenMenu();//volta ao menu principal básico
}
if (c == cmdExit){
destroyApp(false);
notifyDestroyed();
}
}
}
public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
}
class VectorRecords extends Vector{
String text_name,text_endereço,text_phone,text_email;
VectorRecords(){
}
}
Obrigado pela ajuda ai!!