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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:48:46+00:00 2026-06-04T10:48:46+00:00

@Override protected void onMessage(Context context, Intent intent) { Log.e(C2DM, Neue Message.); Intent resultIntent =

  • 0
@Override
protected void onMessage(Context context, Intent intent) {
    Log.e("C2DM", "Neue Message.");
    Intent resultIntent = new Intent(context, ResultActivity.class);
    resultIntent.putExtra("message", "Message received");
    resultIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
}

I can see from my logcat that i get into this method, then when it tried to start the activity, it throws the fatal exception as written in title with the following comment:

android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
(my reply to AndroidRuntime is: “Isn’t that what I’m doing?”) 😉

  • 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-04T10:48:47+00:00Added an answer on June 4, 2026 at 10:48 am

    You are passing the wrong intent variable to startActivity() call. You want to use resultIntent to start the new activity and you are adding FLAG_ACTIVITY_NEW_TASK flag to resultIntent but when starting the new activity you are passing intent by mistake i.e

    resultIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
    

    change this to

    resultIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(resultIntent);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

@Override protected void onStop() { super.onStop(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(Test message) .setCancelable(true)
I have the following Behavior: public class NavigateAndBroadcastAction : NavigateToPageAction { protected override void
public class SettingsActivity extends PreferenceActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /*
public class Browser1Activity extends Activity { TextView url; WebView ourBrow; @Override protected void onCreate(Bundle
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case
GIN Module: public class InjectorModule extends AbstractGinModule { @Override protected void configure() { bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);
Here are the values I want to get in another class. @Override protected void
I have working proxy: proxy = new RpcProxy<List<EmpDTO>>() { @Override protected void load(Object loadConfig,
Activity that is sending the putExtra() @Override protected void onListItemClick(ListView l, View v, int
Here's the code: public class MenuTabActivity extends TabActivity implements OnTabChangeListener{ @Override protected void onCreate(Bundle

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.