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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:01:47+00:00 2026-06-13T23:01:47+00:00

I am having 4 buttons at the bottom. Suppose A,B,C,D. These buttons I have

  • 0

I am having 4 buttons at the bottom. Suppose A,B,C,D. These buttons I have created as a widget and including in every layouts. ON each button click I am opening one activity which I have implemented in Common class. When my application starts A will be on selected state, under A I am starting some activities A1, A2, A3. When I press B, B will be in selected state and B1 activity will be started. I am setting CLEAR_TOP flag when I start B1, but the activities I started under A is not clearing. When I click A button again A1 activity will be started and all the activities like A2 and A3(previously started) will be cleared. But B1, B2 are not getting cleared. why it is happening.

public class TabBar implements OnClickListener{

private Context fContext;
//private Activity fActivity;
private Button btnHome, btnReward, btnProfile, btnFav;



private Activity activity;

//private Button venues,orders,about;

public TabBar(Activity activity, Context context) {
    this.activity = activity;
    btnHome = (Button)activity.findViewById(R.id.btn_tab_home);
    btnReward = (Button)activity.findViewById(R.id.btn_tab_rew);
    btnProfile = (Button)activity.findViewById(R.id.btn_tab_profile);
    btnFav = (Button)activity.findViewById(R.id.btn_tab_fav);
    btnHome.setOnClickListener(this);
    btnReward.setOnClickListener(this);
    btnProfile.setOnClickListener(this);
    btnFav.setOnClickListener(this);





}

@Override
public void onClick(View v) {
    int id = v.getId();
    switch (id) {
    case R.id.btn_tab_home:


            Intent int1 = new Intent(activity, HomeActivity.class);
            int1.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            int1.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP);
            activity.startActivity(int1);
            activity.finish();
            activity.overridePendingTransition(0, 0);

        break;

    case R.id.btn_tab_rew:


            Intent int2 = new Intent(activity, Rewards.class);
            int2.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            int2.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP);
            activity.startActivity(int2);
            activity.finish();


        break;

    case R.id.btn_tab_profile:


            Intent int3 = new Intent(activity, ProfileActivity.class);
            int3.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            int3.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP);
            activity.startActivity(int3);
            activity.finish();


        break;


    case R.id.btn_tab_fav:


            Intent int4 = new Intent(activity, FavouritesActivity.class);
            int4.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            int4.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP);
            activity.startActivity(int4);
            activity.finish();


        break;

    default:
        break;
    }
}
  • 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-13T23:01:48+00:00Added an answer on June 13, 2026 at 11:01 pm

    Note, Clear top stack, will clear all the activities of top of some activity from activity stack, if it is present in activity stack. If it is not present in activity stack, then it will push new activity B1 on activity stack.

    In your case, Activity B1 is not present in activity stack, so it wont pop any activity from activity stack and will just push a new activity B1 on activity stack.

    If you want to Implement TabBar, then you should use TabFragment or TabActivity for the purpose.

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

Sidebar

Related Questions

In my html page I have 4 buy buttons. On clicking each button corresponding
A small - little question. I have seen many application having buttons like following.
I'm having trouble aligning menu buttons properly. How do I move up a button
I am having trouble copying buttons into an appended row: I have a jsfiddle:
I have added a LinearLayOut having some buttons My screen is RelativeLayOut it self
I am having a PHP (HTML) page with 2 buttons.One button is used to
In my sample application am having 3 action buttons in bottom of JSF page
I have pages with varying numbers of radio buttons. These buttons have two different
I have created a custom scrollable tabbar [scrollview with buttons over it] below navigationcontroller.
by simple I mean, having buttons: bold, italic, numbered list bullet point list indent

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.