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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:58:21+00:00 2026-06-16T23:58:21+00:00

I am developing an Android application with few views like A,B,C,D. Here D is

  • 0

I am developing an Android application with few views like A,B,C,D. Here D is my home activity. My navigation is like A->B->C->D. Once I reach Activity D, when I try to press back button, all previous activities (A,B,C) should close. I can’t start activity like finish called calling new activity. Please provide me a way to kill activity of my application.

Here I’ve used some code to finish all activities but did not get result.

ActivityManager manager =  (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
List<RunningAppProcessInfo> list = manager.getRunningAppProcesses();

if(list != null)
{
    for(int i=0;i<list.size();++i) {
        if(getApplicationContext().getPackageName().matches(list.get(i).processName)) {
            int pid = android.os.Process.getUidForName(getApplicationContext().getPackageName());
            android.os.Process.killProcess(pid);
        } 
        else {
            debug.log("app not killed");
        }
    }
}

So please suggest me proper way to close all my activity at a time.

Thanks in advace

  • 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-16T23:58:22+00:00Added an answer on June 16, 2026 at 11:58 pm

    Thank you for all who respond for my question. Finally i got the solution for my issue. I resolved that by using the intent Intent.FLAG_ACTIVITY_CLEAR_TOP. Here is explanation for my scenario.
    Assume i am in Activity D. My actual flow is A->B->C->D.i want to kill my previous activities A,B,C. I used to call my first activity A when i am going from Activity D.
    So i added intent FLAG_ACTIVITY_CLEAR_TOP to call activity A. So the middle activities will cleared and will show only Activity A. And i am passing some flag value as intent extras to activity A. like this

    Intent intent = new Intent(D.this,A.class);
                    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    intent.putExtra("finishstatus", true);
                    this.startActivity(intent);
                    this.finish();
    

    and i am checking the bundle value in onCreate method of Activity A like

    bundle = this.getIntent().getExtras();
            if(bundle!= null)
            {
                boolean isActivityToBeFinish = this.getIntent().getExtras().getBoolean("finishstatus");
                if(isActivityToBeFinish)
                {
                    finish();
                    }
        }
    

    If the status value available and it is true then i am finishing the activity A also. So my problem is cleared and i am successfully finishing the all previous activities.

    May be my explanation is not good but will work perfectly.

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

Sidebar

Related Questions

I am developing an Android Application and I have an Activity that looks like
I'm developing an Android application. On one activity I have a List with list
I am developing Android Application having the listview in an activity . I implemented
I am developing a small application in android in which i have few image
So, here is the deal. I'm developing an Android application (although it could just
I am developing android application but i don't know how to integrate two activity
I am developing an android application where I want to integrate facebook like. I
I'm developing an application for android 2.3.3. It contains a few TextViews to show
I'm developing an Android application very much like the the Android Market (now Google
I'm developing an application for android 2.3.3. It contains a few EditView's to show

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.