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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:06:08+00:00 2026-06-05T22:06:08+00:00

I am trying to start the main activity from inside a BroadcastReceiver. I dont

  • 0

I am trying to start the main activity from inside a BroadcastReceiver.
I dont want to supply the activity class name but to use the action and category for android to figure out the main activity.

It doesnt seem to work.

Sending Code:

Intent startIntent = new Intent();

startIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startIntent.setAction(Intent.ACTION_MAIN);
startIntent.setPackage(context.getPackageName());
startIntent.addCategory(Intent.CATEGORY_LAUNCHER);        
context.startActivity(startIntent);

I get this error:

Caused bt: android.content.ActivityNotFoundException: No Activity found to handle Intent {
act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
flg=0x10000000 pkg=com.xyz.abc (has extras) }

Any ideas?

  • 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-05T22:06:10+00:00Added an answer on June 5, 2026 at 10:06 pm

    this is not the right way to startActivity.
    try this code instead:

    Intent startIntent = new Intent(context, MainActivity.class);
    startIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);        
    context.startActivity(startIntent);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to start a new activity from a non-activity class. From the main
I am trying to start an activity from my main activity. Its not working
I'm trying to start an Activity in my AsyncTask from the doInBackground() method but
i'm trying to start a map activity from a normal Activity. But keep getting
I'm trying to start a phantomjs process from python but for some reason it's
I am trying to start service from AsyncTask but cant see that its starts.
I'm trying to start a new Activity from a PreferenceActivity. However, it fails with
I'm new on Android, and I'm trying to start an Activity from a MenuItem
I'm trying to use a custom class (be.myname.rssreader.util.Global) extending android.app.Application, but when I try
I'm trying to start a Skype intent from my Android App, passing a phone

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.