Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User gracy's Avatar
    Join Date
    Nov 2010
    Posts
    43
    I want to exit the program after showing the alert.
    So I display the alert and call notifyDestroyed()
    display.setCurrent(alert)
    alert.setTimeout(Alert.FOREVER);
    notifyDestroyed();

    But the program exit without showing the alert.
    So I write the following way.
    Is there any better way?

    Code:
    alert=new Alert("","***********************",null,AlertType.ALARM);
    			display.setCurrent(alert);
    			alert.setTimeout(Alert.FOREVER);
    			cmdExit=new Command("Exit",Command.EXIT,0);
    			alert.addCommand(cmdExit);
    			alert.setCommandListener(this);
    			
    		}
    		
    		else
    			display.setCurrent(mainform);
    			
    		
    
    	}
    
    	public void commandAction(Command c, Displayable d) {
    		notifyDestroyed();
    		
    	}

  2. #2
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    One more solution, add the command on the Alert and show the same when the Alert is displayable. Now you can handle the command handling inside the commandAction(), like if command is exitCommand then call the method which exits the app.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

Similar Threads

  1. How to exit after showing alertbox?
    By gracy in forum Mobile Java General
    Replies: 2
    Last Post: 2011-01-13, 21:14
  2. Grid icons not showing( Only numbers are showing)
    By Hitangshu in forum Symbian User Interface
    Replies: 2
    Last Post: 2009-03-24, 14:41
  3. thread was stop and exit for EExitPending exit type
    By dznlong in forum Symbian C++
    Replies: 1
    Last Post: 2006-06-16, 10:27

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved