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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:46:46+00:00 2026-05-31T09:46:46+00:00

Hi hopefully this will be an easy one. I need to implement the classic

  • 0

Hi hopefully this will be an easy one. I need to implement the classic “call app from another app” in Android, which has tons of suggestions on Internet and SO.

I tried:

Intent intent = new Intent(Intent.ACTION_MAIN);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setComponent(new ComponentName("a.b.c","a.b.c.classname"));
        getContext().startActivity(intent);

and

    Intent intent = getContext().getPackageManager()
            .getLaunchIntentForPackage(app);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    getContext().startActivity(intent);

they both work and correctly spawn a new activity from my app, especially if the app was not running.

When the app is already running I get problems because I see that the methods above call the onCreate()/onRestart() methods rather than onResume()/onRestart() as in a “manual” selection of the app (i.e. touching the icon form desktop, that works fine).

The problem in calling onCreate() again is that I set up a TCP server here, which obviously cannot be re-created on the same port.

I could in principle check if the app is running and hijack the onCreate() to onResume() method but that’s a bit of a bad hack.

Any ideas to do this “right”?

cheers

  • 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-31T09:46:48+00:00Added an answer on May 31, 2026 at 9:46 am

    I think you can pass parameter when you start another application.
    You can see this as a reference pass parameter when start other application.
    When the OnCreate function is called, it check the parameter and start TCP server if needed.

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

Sidebar

Related Questions

This will hopefully be an easy one. I have an F# project (latest F#
Hopefully this will be an easy one to answer. I created a class in
Hopefully this will be an easy one to answer. I am working on a
Hopefully this will be an easy one for anyone with any Django experience. I'm
Hopefully this is an easy one... I need to create an Alert Me button
This will hopefully be an easy one, but I'm lacking the skills! <select name=search_category
hopefully this will be an easy answer for some of you CSS veterans out
Hopefully, this will be an easy answer for someone with Javascript time behind them...
Hopefully this will not spark a religious war... We have a web based app
Hopefully this will be an easy question! I have two tables, a 'client(s)' table

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.