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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:52:30+00:00 2026-06-16T19:52:30+00:00

I want to create multiple instances of an activity from BroadcastReceiver , the activity

  • 0

I want to create multiple instances of an activity from BroadcastReceiver, the activity contains a AlertDialog, currently I am using the following code for this purpose:

 Intent intent = new Intent(this, MultipleInstanceActivity.calss);
 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 context.startActivity(intent);

and in manifest file android:launchMode="standard" somehow I think this FLAG_ACTIVITY_NEW_TASK causing the android:launchMode="standard" to change to android:launchMode="singleInstance" or something. I am not able to create multiple instances of this activity. I also tried to use FLAG_ACTIVITY_MULTIPLE_TASK, but no use.

I have created a PreferenceActivity, what really puzzles me is that when this PreferenceActivity is open my app creates multiple dialogbox i.e multiple instances with different data on it. But when its not open, my app wont create multiple instances just to make clear, it wont open another dialog. Logcat is not giving any warnings or errors.

My questions:

  1. How to create multiple instances of an activity from BroadcastReceiver?

  2. Can someone explain me whats happening in the second case, the PreferenceActivity one, why is it creating multiple instances?

  • 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-16T19:52:31+00:00Added an answer on June 16, 2026 at 7:52 pm

    I ran into the same problem as you have here, and i solved it by Using both FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_MULTIPLE_TASK.

    Intent intent = new Intent(context, YourActivityClass.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
    context.startActivity(intent);
    

    Hope this works for you too.

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

Sidebar

Related Questions

Consider the code below. I do not want to create multiple instances of class
I am attempting following code to create multiple instances of a class at run-time
I want to create multiple instances of an activity in the same process. Should
i want create multiple search where statement $where_search is a multiple condition from post
I want to create multiple versions of print-friendly pages from a single page. I
I`v come across a need where I want to create multiple list items from
I want to create a single video file from multiple video files (parts). I
I want my code to automatically try multiple ways to create a database connection.
I wanna create a public repo (bare repo) which contains multiple submodules. I want
I want to create multiple instances of Zend_Auth class as I have two modules

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.