bom, acho que estou começando a entender, mas mesmo assim não estou conseguindo!
eu fiz as duas tentativas abaixo, mas em nenhuma delas abre a tela.
eu debuguei e vi que ele passa por esse código, mas termina e não da resultado nenhum… pq será??
por favor, de uma olhada!!
obs. eu acho que a 1ª tentativa faz mais sentido do que a 2ª porque se eu quizer voltar do form para a listagem teoricamente funcionaria enquanto da segunda forma não
1ª Tentativa:
[code]package hello;
import javax.microedition.lcdui.;
import java.util.;
public class CCliente extends List implements CommandListener
{
Command closeCommand;
Command formCommand;
List listCliente;
Form formCliente;
public CCliente()
{
super("DevMobile", Choice.IMPLICIT);
closeCommand = new Command("Voltar", Command.BACK, 0);
formCommand = new Command("Abrir", Command.OK, 1);
setCommandListener(this);
Display display = Display.getDisplay(Projeto.app);
display.setCurrent(listClientes);
}
List getlistClientes()
{
if (listClientes == null)
{
listClientes = new List("clientes", Choice.IMPLICIT);
listClientes.addCommand(closeCommand);
listClientes.setCommandListener(this);
}
return listClientes;
}
Form getFormCliente()
{
if (formCliente == null)
{
formCliente = new Form("cliente");
formCliente.addCommand(closeCommand);
formCliente.setCommandListener(this);
}
return formCliente;
}
public void commandAction(Command c, Displayable d)
{
if ( c == formCommand )
{
Display display = Display.getDisplay(Projeto.app);
display.setCurrent(FormCliente);
}
}
}[/code]
2ª tentativa:
[code]package hello;
import javax.microedition.lcdui.;
import java.util.;
public class CCliente extends List implements CommandListener
{
Command closeCommand;
Command formCommand;
List listCliente;
Form formCliente;
public CCliente()
{
super("DevMobile", Choice.IMPLICIT);
closeCommand = new Command("Voltar", Command.BACK, 0);
formCommand = new Command("Abrir", Command.OK, 1);
listClientes = new List("Clientes", Choice.IMPLICIT);
listClientes.addCommand(closeCommand);
listClientes.addCommand(formCommand);
listClientes.setCommandListener(this);
}
Form getFormCliente()
{
if (formCliente == null)
{
formCliente = new Form("cliente");
formCliente.addCommand(closeCommand);
formCliente.setCommandListener(this);
}
return formCliente;
}
public void commandAction(Command c, Displayable d)
{
if ( c == formCommand )
{
Display display = Display.getDisplay(Projeto.app);
display.setCurrent(FormCliente);
}
}
}[/code]