Pessoal, estou começando a mexer com o java mobile e ai em baixo esta o meu primeiro codigo.
Ambos feito no eclipse e no netbeans, porem, ambos estao com o mesmo erro. Já tentei colocar abstract mas
ao aparecer a tela do emulador, nao aparece nada. Alguem poderia me dar um help?
C:\Documents and Settings\Administrator\My Documents\NetBeansProjects\PrimeiraMid\src\PrimeiraMID.java:5: PrimeiraMID is not abstract and does not override abstract method startApp() in javax.microedition.midlet.MIDlet
public class PrimeiraMID extends MIDlet {
Vc precisa declarar um método chamado startApp() pois MIDlet declara ele como abstrato!
A
alcidesflachPJ
Ola’ rhkw,
Segue um exemplo de código que acredito que será grande ajuda. Esta aplicação apenas escreve “Hello World!” na tela.
importjavax.microedition.lcdui.Command;importjavax.microedition.lcdui.CommandListener;importjavax.microedition.lcdui.Display;importjavax.microedition.lcdui.Displayable;importjavax.microedition.lcdui.Form;importjavax.microedition.midlet.MIDlet;importjavax.microedition.midlet.MIDletStateChangeException;/** * This class is used to test basic execution of MIDLet HelloWorld. * * @author Alcides Flach * * @see javax.microedition.midlet.MIDlet */publicclassHelloWorldextendsMIDletimplementsCommandListener{privateDisplaydisplay;privateFormform;privateCommandexit;/** * Create an instance of the MIDlet HelloWorld. */publicHelloWorld(){// call the super class constructor super();// create a command to finish the applicationexit=newCommand("EXIT",Command.EXIT,1);// create a form objectform=newForm("J2ME Testing");// append the messegeform.append("Hello World!");// add the commandform.addCommand(exit);// set the form to listen the eventsform.setCommandListener(this);}protectedvoidstartApp()throwsMIDletStateChangeException{// get the display instace of this MIDletdisplay=Display.getDisplay(this);// set the form object visible on the displaydisplay.setCurrent(form);}publicvoidcommandAction(Commandc,Displayabled){// verify if the command event is the exit commandif(c==exit){try{// signals the MIDlet to terminate and enter the Destroyed statedestroyApp(false);}catch(MIDletStateChangeExceptione){e.printStackTrace();}// notify the application management software that it has entered// into the Destroyed statenotifyDestroyed();}}protectedvoidpauseApp(){}protectedvoiddestroyApp(booleanarg0)throwsMIDletStateChangeException{}}
Oi RHKW o negocio seguinte, o seu metodo ta com nome trocado:
public void stardApp(){ deveria ser public void startApp(){ , tente inverter o nome. Blzinha??? Abraços.