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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T20:33:28+00:00 2026-05-12T20:33:28+00:00

I have an app that allows you to create Home shortcuts to a specific

  • 0

I have an app that allows you to create Home “shortcuts” to a specific Activity. It turns out that some of my users will use the app, hit the home key to go do something else, then use one of the shortcuts to jump back to that Activity. Since the app is still in memory it just opens the new Activity on top of the others and the “Back” key will take them back through the whole history. What I’d like to have happen is if they use a shortcut then to effectively kill the history and have the back key just exit the app. Any suggestions?

  • 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-12T20:33:28+00:00Added an answer on May 12, 2026 at 8:33 pm

    First, set up the taskAffinity in the Manifest to make the Activity run as a different “task”:

    <activity
            android:taskAffinity="" 
            android:name=".IncomingShortcutActivity">
            <intent-filter>
                <action android:name="com.example.App.Shortcut"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
    </activity>
    

    then, when building the shortcut, set the FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_CLEAR_TOP flags. Something like:

    // build the shortcut's intents
    final Intent shortcutIntent = new Intent();
    shortcutIntent.setComponent(new ComponentName(this.getPackageName(), ".IncomingShortcutActivity"));
    shortcutIntent.putExtra(EXTRA_STOPID, Integer.toString(this.stop_id));
    shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    final Intent intent = new Intent();
    intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    // Sets the custom shortcut's title
    intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, custom_title);
    // Set the custom shortcut icon
    intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(this, R.drawable.bus_stop_icon));
    // add the shortcut
    intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
    sendBroadcast(intent);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that allows you to create shortcuts in Home Screen. But
I have a topics app that allows users to create topics. For each individual
I have an app that allows users to upload large data files and then
I have an iPhone app that allows users to record videos and I'd like
We have a WPF app that allows our users to download encrypted content and
I have a basic app that allows user1 to create a redeemable code. user1
I have an app that allows users to generate objects, and store them (in
I have a Django app that allows the user to create variables and name
We have a desktop app that allows users to fill in a questionnaire. For
I am working on a simple django app that allows users to create posts

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.