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

  • Home
  • SEARCH
  • 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 8266779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:17:01+00:00 2026-06-08T05:17:01+00:00

I want to manage all activities with class conductor like this: Also all activities

  • 0

I want to manage all activities with class conductor like this:
enter image description here

Also all activities extend base activity to use common view.
In this case, I want to handle transfer activity, for example:

 Base -> First -> Second -> Third -> First
 Base -> First -> Fourth -> Fifth -> Fourth

When transferring activity, Conductor must handle all activity in stack.
I try to write this conductor as below (I use list to manage instead of stack):

public class Conductor {    
   private List<Activity> listOfActivityInStack;  

   public Conductor(){
  listOfActivityInStack = new ArrayList<Activity>();
   }
   public void startActivity(Activity activity, Class<?> cls){
  listOfActivityInStack.add(activity);
  Intent i = new Intent(activity.getApplicationContext(), cls);
  activity.startActivity(i);
}

   public void startActivityForResult(Activity activity, Class<?> cls, int requestCode){
  listOfActivityInStack.add(activity);
  Intent i = new Intent(activity.getApplicationContext(), cls);
  activity.startActivityForResult(i, requestCode);
}

   public void startAcitivtyClearPrevious(Activity activity, Class<?> cls){
  listOfActivityInStack.clear();
  listOfActivityInStack.add(activity);
  Intent i = new Intent(activity.getApplicationContext(), cls);
  i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  activity.startActivity(i);
}

   public int getCount(){
  if(listOfActivityInStack == null)
    return 0;
  return listOfActivityInStack.size();
 }
 }

I store this conductor in Global variable. Then I use it as below:

  //Get conductor from application global
  conductor.startActivity(FirstActivity.this, SecondActivity.class);
  //Then add conductor to application global

But I have some problem:

  • I must handle goBack() for all activity to remove activity from list.
  • Check activity has exist in list, if yes, try get its instance.

Is there best way to manage all activity on android? I have tried search but not found good answer.
I wonder weather or not my way is right. Any recommend or example would be 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-06-08T05:17:05+00:00Added an answer on June 8, 2026 at 5:17 am

    there is one way to do this. you must save your all activities state. and when you need to recall them you must use that state.

    for extra info look here:

    Saving Android Activity state using Save Instance State

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

Sidebar

Related Questions

I'm designing a UI manager class that will manage all my UI elements (this
on one of my web pages I want my manager user to view all
I want to use the TFS WebAccess to open/manage work items. I have found
I have a web application I want to build, how should I manage all
I use Versions on OS X to manage all my code in Subversion. I'm
I thought this would be simple, but I'm struggling. I want to manage Subversion
I want to make Security authorization management model that can manage all roles and
I'm developing an Android 2.2 application. I use C++ to manage all OpenGL ES
We are currently setting up opscode chef and we want to manage all cookbooks,
I want to manage permissions and access to a SQL Server database server on

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.