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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:20:09+00:00 2026-05-28T00:20:09+00:00

I’m writing an application which have two modes; one view mode and one edit

  • 0

I’m writing an application which have two “modes”; one view mode and one edit mode. The application exposes two main/launcher activities (say, A and D) which in turn have their own activity chains (B, C and E, F respectively). The two entry point activities A and D will expose two icons with separate labels in the home screen and the two chains are never crossed, i.e. once you start the application in a view mode with activity A, the only route you can walk back and forth is A, B, C and if you start the application in edit mode with activity D, the only available activity chain is D, E, F.

Now, my problem is that if start the application in, e.g. view mode (activity chain A, B, C) and press the Home button from any activity in that chain I get back to the home screen (of course) but if I then re-start the application in edit mode (activity chain D, E, F) I get to the activity I was on when pressing the Home button (that is, an activity in the wrong chain) – not the expected entry point for edit mode; activity D.

How do I solve this?

I have tried various combinations of android:noHistory, android:clearTaskOnLaunch and other attributes in AndroidManifest.xml for the involved activities. But they only seem to affect the very activity, not the entire chain.

I would like to remove the entire chain of activities (A, B, C or D, E, F) from the history stack when the Home button is pressed but still keep the stack intact while I’m still in the chain (I want to be able to press the back button from, say, activity B and get to activity A).

  • 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-05-28T00:20:11+00:00Added an answer on May 28, 2026 at 12:20 am

    Sounds like you need to use the Intent.FLAG_ACTIVITY_CLEAR_TOP flag on your home activities, but of course you can’t add these flags in the AndroidManifest.xml file. Maybe you should have a single point of entry which then launches the correct Activity – you can use an activity-alias to make it look like two points of entry to the user.

    For example – you define the activities in your manifest file:

       <activity-alias
            android:label="@string/edit_app_name"
            android:name="launch_edit"
            android:targetActivity=".activities.LaunchActivity">
            <meta-data android:name="launch_type" android:resource="@string/launch_edit" />
        </activity-alias>
        <activity-alias
            android:label="@string/view_app_name"
            android:name="launch_view"
            android:targetActivity=".activities.LaunchActivity">
            <meta-data android:name="launch_type" android:resource="@string/launch_view" />
        </activity-alias>
    

    Then in your LaunchActivity you have:

    ActivityInfo activityInfo = getPackageManager().getPackageInfo( this.getComponentName(), PackageManager.GET_ACTIVITIES|PackageManager.GET_META_DATA);
    int launchTypeResource = activityInfo.metaData.getInt("launch_type");
    String launchType = context.getString(launchTypeResource);
    if(launchType == null) {
       // handle error
       throw new Exception();
    }
    Intent newIntent;
    if(launchType.equals(context.getString(R.string.launch_view)) {
        newIntent = createIntent(ViewActivity.class);
    } else if(launchType.equals(context.getString(R.string.launch_edit)) {
        newIntent = createIntent(EditActivity.class);
    }
    newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    startActivity(newIntent);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a text area in my form which accepts all possible characters from
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the

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.