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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:26:03+00:00 2026-05-27T02:26:03+00:00

Specfically, I have an activity that can be called from the homescreen, OR can

  • 0

Specfically, I have an activity that can be called from the homescreen, OR can be called by selecting “OK” from a dialog pop up in another activity. What I want is for the activity to behave slightly differently (start something automatically rather than waiting for user input ) if it was selected by the pop up.

Knowing nothing else, my first instinct is to simply set a shared preference variable when they select “OK” right before calling startActivity().Then, I can have my activity always check that shared variable before doing anything.

Is this efficient, or is there some built in Android way to do this?

I’ve looked at:

Android – detecting application launch from home or history

And it seems like there’s no way to know if it was launched from the home screen. That’s fine, because in my case I care more about whether it came from the dialog box…I don’t care about any other possible way a user could get to this Activity.

I’m seeing something on “startActivityForResult”….but I’m not really waiting for any result or anything, would it be applicable here? Is there some other similar method I haven’t found yet?

  • 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-27T02:26:03+00:00Added an answer on May 27, 2026 at 2:26 am

    when you start your activity you can put an extra to your intent:

    intent.putExtra(KEY_IS_DIALOG, true);
    

    In your second activity you can then use:

    getIntent().getBooleanExtra(KEY_IS_DIALOG, defaultValue); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an activity that will be started from a parent activity, but the
Specifically, I have an array of strings called val, and want to replace all
Bit of a weird question. I'm passing data from one activity to another -
I have a form called wizard. Everytime any input element is changed, I want
I have an activity that works as a hook for various intents. Specifically, the
I have been using the Serializable interface to pass an object from one activity
I have a table that I am trying to dynamically delete rows from. Each
Specifically I have a PHP command-line script that at a certain point requires input
Are there any compression algorithms -- lossy or lossless -- that have been specifically
I have a database that I used specifically for logging actions of users. 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.