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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:17:26+00:00 2026-05-30T09:17:26+00:00

Hi i am new to android. I am implementing a code with notification functionality.

  • 0

Hi i am new to android.
I am implementing a code with notification functionality. Here i have two activities in my application those are ActivityA, and ActivityB.
I want to start ActivityB from notification and i need to send some flag or some value to the ActivityB. How can i send the data like int value or flag to that called activity using notification on click. The problem is when i am launching activity from launcher icon first it will called ActivityA and from that ActivityA i am passing some value to ActivityB.
But when i am launching ActivityB from notification i con’t send any values to that activity so it is giving force close.

To call activity from notification i am using this code

mNotificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
final Notification notifyDetails = new Notification(R.drawable.android,"New Alert, Click Me!",System.currentTimeMillis());
Context context = getApplicationContext();
CharSequence contentTitle = "Notification Details...";
CharSequence contentText = "Browse Android Official Site by clicking me";               
Intent notifyIntent = new Intent(Intent.ACTION_MAIN);
notifyIntent.setComponent(new ComponentName("mypackage","mypackage.ActivityB"));

PendingIntent intent = PendingIntent.getActivity(SimpleNotification.this, 0,notifyIntent, android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
notifyDetails.setLatestEventInfo(context, contentTitle, contentText, intent);
mNotificationManager.notify(SIMPLE_NOTFICATION_ID, notifyDetails);

Please advise me how can i send values from notification to called activity.

  • 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-30T09:17:28+00:00Added an answer on May 30, 2026 at 9:17 am

    you must set your ActivityB in notifyIntent

    Intent notifyIntent = new Intent(this, ActivityB.class); // 'this' - Context object
    

    For sending values use extras
    for example:

    intent.putExtra("yourTag", yourVariable);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am creating a new android application.i am using the table layout. I have
I am implementing a Map Kit based application in Android. I was very new
I am implementing PayPal in my Android application and I want to send multiple
Im implementing a video playback in android im completely new to android, and this
I am a new android app developer and i want to use google map
I am new android app developer i want make app for tablets and phone
I having some difficulty implementing a context menu into my android application. My first
Can I use progress bar in android, without the thread? HERE IS CODE OF
I'm currently working on an Android application. I wish to have a GridView on
I have requirement of implementing USB communication in Android phone. I have searched and

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.