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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:29:52+00:00 2026-06-05T06:29:52+00:00

I am making an application which has about 5 pages along with a starting

  • 0

I am making an application which has about 5 pages along with a starting screen, I am aware that if I write finish() in the onPause() method the page will get destroyed once the user goes to the next page.

My requirement is such that I don’t want the AppPage 1 to be destroyed till I reach the 3rd page of the application, but as soon as the user goes to 4th page of application, I want to destroy all the 1,2,3 AppPages of my application so that they cannot be accessed by clicking the back button and reaches directly to the starting screen of my application which I am not killing at the starting of the application.

So I want to ask is it possible to kill my application’s 1,2,3 pages when the user clicks on the go to next page button of the 3rd page.

Thanks

==== Edit =====

Starting Screen -> AppPage1 -> AppPage2 –> AppPage3 –> AppPage4 (Kill AppPage1,2,3 here, so that if back is clicked user reaches starting sceen) –> Appage 5 (Kill AppPage4)

==== Edit 2 =====

AppPage1.java

public class AppPage1 extends Activity{

Button goToAppPage2;
BroadcastReceiver logout;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.apppage1);

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction("com.closing.application.pages.AppPage1");

    logout = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
          finish();
        }
    };

    registerReceiver (logout, intentFilter);

    goToAppPage2 = (Button) findViewById(R.id.goToAppPage2);
    goToAppPage2.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            // TODO Auto-generated method stub

            Intent i1 = new Intent(AppPage1.this, AppPage2.class);
            startActivity(i1);
        }
    });  

}

@Override
protected void onDestroy() {
    // TODO Auto-generated method stub
    super.onDestroy();
    unregisterReceiver(logout);
}

}

AppPage2.java

public class AppPage2 extends Activity{

Button goToAppPage3;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.apppage2);

    Intent intent = new Intent("kill");
    intent.setType("spartan!!!");
    sendBroadcast(new Intent(this, AppPage1.class));



    goToAppPage3 = (Button) findViewById(R.id.goToAppPage3);
    goToAppPage3.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            // TODO Auto-generated method stub

            Intent i1 = new Intent(AppPage2.this, AppPage3.class);
            startActivity(i1);

        }
    });    
} 
}
  • 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-05T06:29:53+00:00Added an answer on June 5, 2026 at 6:29 am

    You can achieve this through a broadcast message. I am using it myself in the case where the Activities depend on the user to be logged-in, so when he logs out, all those Activities should be finished and only the login screen should remain.

    First, register the broadcast in the activities that should be finished. If the number of activities is big, you can create a parent Activity from where the other can extends, so you don’t have to repeat this code so many times:

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction("com.example.ACTION_LOGOUT");
    BroadcastReceiver logout = new BroadcastReceiver() {
    
        @Override
        public void onReceive(Context context, Intent intent) {
          finish();
        }
    };
    registerReceiver (logout, intentFilter);
    

    Don’t forget to unregister it onDestroy():

    unregisterReceiver(logout);
    

    Send the broadcast when you wish to finish the previous activities:

    Intent broadcastIntent = new Intent();
    broadcastIntent.setAction("com.example.ACTION_LOGOUT");
    sendBroadcast(broadcastIntent);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making an application which has j2me in client side and dotnet on
I am making an iphone application which has a zip code field. When the
I'm making a very simple application which has to perform an action when the
I am making an application which is a user interface to access 2 types
I'm making an application which uses MANY images. The application gets the images from
I am making an application which will run automatically on phone start up. Now
I am making an application which will have an interface similar to Photoshop: multiple
I am making an application (iPhone app) which gets information (jokes) from an RSS
I am making an application in C# which uses a winform as the GUI
I am making a messaging application in which user can send or receive 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.