×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    43

    How to exit after showing alertbox?

    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
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: How to exit after showing alertbox?

    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. 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
  •  
×