Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2005

Tip: Looking for answers? Try searching our database.

newbie: problems destroying midlet

Thread view: 
Jeff - 06 Oct 2005 21:43 GMT
Hey

J2ME Wireless Toolkit 2.2
JDK 5

My midlet below, doesn't exit when hitting the exit key, I'm not sure what
I'm doing wrong here... I've spent hours investigate the problem, but I
cannot see why it can't exit when pushing the exit key (exit key =  the
right soft key.... I guess it's standard that the right soft key is the exit
button)

package com.test;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class chemistry extends MIDlet implements CommandListener
{
private static Display display;
private Command exitCommand = new Command("Exit", Command.EXIT, 99);
private Form form;
private StringItem lblWelcome;
private StringItem lblInfo;

public chemistry()
{
 form = new Form("Chemistry");
 //Add GUI elements:
 lblInfo = new StringItem("Please make a selection", null);
 lblInfo.setLayout(Item.LAYOUT_CENTER);

 //Add commands
 form.addCommand(exitCommand);
}

public void startApp()
{
 Display display = Display.getDisplay(this);
 display.setCurrent(form);
}

  public void pauseApp()
  {
  }

  public void destroyApp(boolean unconditional)
  {

  }

public void commandAction(Command c, Displayable s) {
 if (c == exitCommand) {
  try
  {
   destroyApp(false);
   notifyDestroyed();
  }
  catch (Exception ex)
  {
       }
 }
}
}

I would be very thankful if someone could give me some tips about what I'm
doing wrong here....

Jeff
Roedy Green - 07 Oct 2005 04:40 GMT
>I would be very thankful if someone could give me some tips about what I'm
>doing wrong here....

have you put any code in your action handler to see what is coming
through? Maybe the exit does not look exactly like that.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.