Hello,
I'm learning Java ME and when i complete the development of an application that uses RecordStore, it's simple a contact book, but when i completed the code i see that my program have an error and i use Eclipse, then it marks wrong codes in the left of the line with an X. Here is the error description:
The type simplecontacts must implement the inherited abstract method CommandListener.commandAction(Command, Displayable)
Here is the code of my program:
package contacts;
import java.io.*;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.rms.*;
import javax.microedition.lcdui.*;
public class simplecontacts extends MIDlet implements CommandListener, ItemStateListener {
private Display display;
private Alert alerta;
private Form telainicial, adicionaReg;
private TextField nome, telefone;
private Command sair, adicionar, voltar, salvar, zerar;
private RecordStore rs = null;
String tipo, mensagem;
boolean gravacaoOK = false;
private ChoiceGroup tipo_contato;
private String[] listaTipo = {"Amigos", "Família", "Trabalho"};
public simplecontacts() {
display = Display.getDisplay(this);
sair = new Command("Sair", Command.EXIT, 0);
adicionar = new Command("Adicionar Registros", Command.SCREEN, 1);
zerar = new Command("Zerar Registros", Command.SCREEN, 1);
voltar = new Command("Voltar", Command.SCREEN, 1);
salvar = new Command("Salvar Registro", Command.SCREEN, 1);
nome = new TextField("Nome:", "", 20, TextField.ANY);
telefone = new TextField("Telefone:", "", 10, TextField.PHONENUMBER);
telainicial = new Form("Simple Contacts");
telainicial.addCommand(sair);
telainicial.addCommand(adicionar);
telainicial.addCommand(zerar);
telainicial.setCommandListener(this);
adicionaReg = new Form("Adiciona Contato");
tipo_contato = new ChoiceGroup("Tipo do Contato", Choice.POPUP, listaTipo, null);
adicionaReg.append(nome);
adicionaReg.append(telefone);
adicionaReg.append(tipo_contato);
adicionaReg.addCommand(salvar);
adicionaReg.addCommand(voltar);
adicionaReg.setItemStateListener(this);
adicionaReg.setCommandListener(this);
}
protected void destroyApp(boolean arg0) {
notifyDestroyed();
}
protected void pauseApp() {
// TODO Auto-generated method stub
}
protected void startApp() throws MIDletStateChangeException {
try …