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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:10:40+00:00 2026-06-03T12:10:40+00:00

When using flag FLAG_ACTIVITY_NEW_TASK, if a task is already running for the activity you

  • 0

When using flag FLAG_ACTIVITY_NEW_TASK, if a task is already running for the activity you are now starting, I want a new activity to not be started – instead, I want the current task to simply be brought to the front of the screen it was last in.

  1. How can I do it from service of other app? I would like to launch app which is in actvityManager.getRunningAppProcesses() by service. I know how to start this app only as a new one:

    Context context = this.getBaseContext();
    

    PackageManager pm = context.getPackageManager();
    Intent intent = pm.getLaunchIntentForPackage(LevelappPackageName);
    context.startActivity(intent);

But I would like to perfom it this way:

    context.startActivity(intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
  1. I know how to find out if my app is running:

    ActivityManager actvityManager = (ActivityManager) this.getSystemService( ACTIVITY_SERVICE );
    List<RunningAppProcessInfo> App = actvityManager.getRunningAppProcesses();
    for(int i = 0; i < App.size(); i++)
        {   
            if(App.get(i).processName.equals("myapp"))
    

    But how can I know if some app is currently running – it is on screen at this moment?!

  • 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-03T12:10:41+00:00Added an answer on June 3, 2026 at 12:10 pm

    You will need to add an intent-filter action to the manifest of the Activity you wish to start. You will also need a PendingIntent with the correct action that you can send from the Service. You may also need to look the manifest launchMode=singleTop and/or Context.startActivityIfNeeded.

    If an Activity has focus its onWindowFocusChanged method will be called. Use that to set a variable you can read.

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

Sidebar

Related Questions

I'm trying to monitor the gc activity in my app, using -verbosegc flag. I
I'm using InnoSetup for creating my application installers and I set the SetupLogging=yes flag
using (var file_stream = File.Create(users.xml)) { var serializer = new XmlSerializer(typeof(PasswordManager)); serializer.Serialize(file_stream, this); file_stream.Close();
Using Nunit, I want to be able to write a test fixture that will
When my notification goes off I want to restore the activity that was put
I have created a Alarm using AlarmManager. Intent intent = new Intent(MyApp.this,NotificationMessage.class); PendingIntent sender
I am using this code: File myDir = new File(getApplicationContext().getFilesDir().getAbsolutePath()); try { Log.i(CSV Testing
I want an activity to be displayed at a certain time. For this, I
I have a fragment in an activity that I am using as a navigation
I have a BroadcastReceiver that I'm using to send data to another activity which

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.