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 8807839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:28:02+00:00 2026-06-14T02:28:02+00:00

I have one main activity Dashboard with a action bar containing home screen icon

  • 0

I have one main activity “Dashboard” with a action bar containing home screen icon and exit button , i go to activity A ->activity B ->activity C from dashboard screen . Now on C, i click on action bar dashboard icon which bring to me on Dashboard screen .

Now i go to activity E ->activity G->activity H from dashboard screen . From H i press exit button , it come to C screen . When again click on exit i go through me out of application.

Why there is need to press 2 times exit button for exit application .

On Home Screen Icon :-

    public void onClickHome(View view){

    final Intent intent = new Intent(getBaseContext(), Dashboard.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);    
    intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);   
    getBaseContext().startActivity(intent);     

    //goDashboard();
                           }

ON exit button :-

    AlertDialog.Builder alert = new AlertDialog.Builder(this);      
    alert.setTitle(getString(R.string.logoutDialogTitle));
    alert.setMessage(getString(R.string.logoutDialogMessage));
    final OnlineBookApp app = (OnlineBookApp) getApplicationContext();

    alert.setPositiveButton(getString(R.string.logoutDialogCancel), new
              DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {      
                               }
                          });

    alert.setNegativeButton(getString(R.string.logoutDialogOk),
            new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {  
            //finish();
            //stopService(new Intent(getBaseContext(), DatabaseSyncService.class));

                      //                
                  //    moveTaskToBack(true);
                 ////  stopService(new Intent(getBaseContext(),
                        DatabaseSyncService.class));
                    //  System.runFinalizersOnExit(true);
                    //  android.os.Process.killProcess(android.os.Process.myPid());
                      //moveTaskToBack(true);
                  //    finish();
                       //   app.SetIsExit(true);
    Intent intent = new Intent(getApplicationContext(), Dashboard.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
            intent.putExtra("EXIT", true);
            startActivity(intent);

                            }
                                         });
    alert.setNeutralButton(getString(R.string.logoutDialogLogout), new
              DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {      
            //finish();
            //stopService(new Intent(getBaseContext(),
                                DatabaseSyncService.class));
            //finish();
            //app.SetIsExit(true);
            //stopService(new Intent(getBaseContext(),
                                  DatabaseSyncService.class));
            app.logout();
            Intent intent = new Intent(getApplicationContext(),
                               Dashboard.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
            intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
            intent.putExtra("EXIT", true);
            startActivity(intent);

                              }
                               });

                    alert.show();
  • 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-06-14T02:28:03+00:00Added an answer on June 14, 2026 at 2:28 am

    If I understood well, you should solve this thanks to the use of finish().

    Taking a look to this post might help.

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

Sidebar

Related Questions

I have a main menu activity with a bunch of buttons. One button starts
I have one activity called mylikes , it can be called from main activity
I have a design of activities like this I have one main activity and
i have main activity in which i have Four menus. and i have one
I have two relatively simple codes. One main activity and one intent service. Main
I have one main outstanding issue, I know now how to databind to lists
I have one main array which is the returned data from a MySQL query
I am using fragments to show images/pages.I have one Activity(Main) which contains all the
I have two activities, one is main and I have another activity called Test
I have a main activity which calls a child one via Intent I =

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.