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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:03:58+00:00 2026-06-15T04:03:58+00:00

I have an app that starts with a StartupActivity. That StartupActivity starts the service,

  • 0

I have an app that starts with a StartupActivity.

That StartupActivity starts the service, like this:

startService(new Intent(StartupActivity.this, SamcomService.class));

At some point, the Service decides to broadcast an Intent, that the StartupActivity reacts to. The Activity, when receiving the INtent, does this:

Intent intent2 = new Intent(StartupActivity.this, DialogActivity.class); 
intent2.putExtra("Centrals", list); // list is defined elsewhere
startActivity(intent2);

As you can see, a new Activity is started, and that Activity happens to have Theme.Dialog as Theme. The Dialog shows a list, where the user should select something. At that point, they should be returned to the first Activity, the StartupActivity.
They should also be returned to the first Activity if pressing BACK.

Here is the onCreate code for the DialogActivity:

@Override
public void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    final ArrayList<tWorks.Samcom.SICJsonProtocol.Objects.Central> list = (ArrayList<tWorks.Samcom.SICJsonProtocol.Objects.Central>)this.getIntent().getSerializableExtra("Centrals");

    // Some more stuff not necessary for this question...
    // ....
    // ....

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Choose");
    builder.setItems(items2, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) 
        {
                        // Do some stuff depending on choice
            finish();
        }
    });
    builder.create().show();
}

THe problem is that the entire app, ie all Activitys etc disappar and I am returned to the Home Screen.

If I do not call “finish()”, then I am left with an “overlay” on top of the StartupActivity, and can’t do anything more. If i press BACK, I am returned to the Home Screen.

So, how can I make the DialogActivity to disappear/go away when selecting something from the list or pressing back?

  • 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-15T04:04:00+00:00Added an answer on June 15, 2026 at 4:04 am

    well it should open you startup screen on back. check you manifest. and in manifest check startup activity if there is any android.nohistry=true. just remove it.

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

Sidebar

Related Questions

I have the following two activities, ActivityA and ActivityB. In ActivityA.java startActivity(new Intent(this, ActivityB.class));
I have an app that starts out in the login screen and when you
I have a winforms app that checks user credentials as it starts. If autharization
I have an App that downloads and displays images from URL's. This works fine
I am using a spinner when selected starts an intent and the class that
I am coding an app that give me some problems. I have an activity
On my code I have 2 apps. the app a that starts app b,
I have an android app that starts with a simple screen and a start
I have some troubles in my Android app. I need to start an intent
I have an Activity (called StartActivity) that starts a Service. The Service calls methods

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.