Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7549635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:59:44+00:00 2026-05-30T09:59:44+00:00

In my application, when i am clicking i showing a dialog. and when i

  • 0

In my application, when i am clicking i showing a dialog. and when i am pressing yes in that Dialog, it is giving me the illegal state exception. But i want to go back in the previous screen. If i am clicking menu and clicking close, then it is going back to the previous screen. Below is my code:

 public boolean keyDown(int keycode, int time) {

        if (Keypad.KEY_ESCAPE == Keypad.key(keycode)) {
            int result = Dialog.ask(Dialog.D_YES_NO, "Do you want to edit the list?");
            if (result == Dialog.YES) 
            {
                try
                {
                    UiApplication.getUiApplication().popScreen(this);
                }
                catch (Exception e) 
                {
                    e.printStackTrace();
                }
//              onClose();
            } 
            else 
            {
                return true;
            }
        } // end if

        return false;
    } 

Please help..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:59:45+00:00Added an answer on May 30, 2026 at 9:59 am

    When you are clicking the back button in the device then default onclose() method is called. So, try to do like this;

    protected boolean onSavePrompt() 
    {
        return true;
    }
    public boolean onClose() 
    {
        int choose=Dialog.ask(Dialog.D_YES_NO, "Close the screen?");
        if(choose==Dialog.YES)
        {
            return super.onClose();
        }
        return true;
    }
    

    This is the better way; If you use like the above one then you may get one problem; That is:

    If you are using that method in the first screen then according to your code when popup the screen then there is no screen in the display stack(Because it is the first screen); So you may get this type of problem;

    Try this one;

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to send my Application to background simply clicking on Button inside my
I have a .NET application running on windows. I want clicking on some page
I'm writing a very simple Android application that showing various shapes on the main
I want to implement the Wikitude API in my iPhone Application. But while implementing
I want to make something akin to a diagram editor - an application that
In my application when a user is clicking any a href link then a
In my application, upon clicking login in the login page, I have to call
User can switch active application by Alt+Tab or by clicking on their icons in
Application, have a TextBlock and two Buttons, the text is displayed TextBlock by clicking
I need to let users of an application open a folder by clicking a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.