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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:57:53+00:00 2026-06-13T02:57:53+00:00

does anyone know what how to use the mId variable in code provided by

  • 0

does anyone know what how to use the “mId” variable in code provided by google?

http://developer.android.com/guide/topics/ui/notifiers/notifications.html

It is not explained in the documentation. but appears as the last line in the code. when am using this code it is undefined so I have to define it as this, “private int mId;”

totally lost on this one. the code where I got this is shown below.

mNotificationManager.notify(mId, mBuilder.build());

 ButtonOne.setOnClickListener(new View.OnClickListener() {

  private int mId;

// anonymous inner class override for on click
public void onClick(View v) {

    Intent myIntent = new Intent(MainActivity.this, CoverFlowExample.class);
     MainActivity.this.startActivity(myIntent);



     NotificationCompat.Builder mBuilder =
                new NotificationCompat.Builder(MainActivity.this)
                .setSmallIcon(R.drawable.ic_launcher)
                .setContentTitle("My notification")
                .setContentText("Hello World!");
        // Creates an explicit intent for an Activity in your app
        Intent resultIntent = new Intent(MainActivity.this, MainActivity.class);

        // The stack builder object will contain an artificial back stack for the
        // started Activity.
        // This ensures that navigating backward from the Activity leads out of
        // your application to the Home screen.
        TaskStackBuilder stackBuilder = TaskStackBuilder.create(MainActivity.this);
        // Adds the back stack for the Intent (but not the Intent itself)
        stackBuilder.addParentStack(MainActivity.class);
        // Adds the Intent that starts the Activity to the top of the stack
        stackBuilder.addNextIntent(resultIntent);
        PendingIntent resultPendingIntent =
                stackBuilder.getPendingIntent(
                    0,
                    PendingIntent.FLAG_UPDATE_CURRENT
                );
        mBuilder.setContentIntent(resultPendingIntent);
        NotificationManager mNotificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        // mId allows you to update the notification later on.
        mNotificationManager.notify(mId, mBuilder.build());


}

});

  • 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-13T02:57:54+00:00Added an answer on June 13, 2026 at 2:57 am

    Its the unique Id used to identify notifications for later manipulation purposes. By default its having value 0.

    If you dont care to retrieve it later for altering, then you dont even need to do private int mId, simply set any value when notifying, for example:

    mNotificationManager.notify(123, mBuilder.build());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know how to use the define function and pass a variable into
Does anyone know how to use the Google safe browsing API. I downloaded the
Does anyone know anyway to use something similar to polygon.getKml() except for the current
Does anyone know how to use an icon instead of text for the UINavigationController
Does anyone know how to use the command line compiler ('cl' and 'link') in
Does anyone know how to use different provider for membership? Actually i want to
I know I can use Request.Browser.IsMobileDevice . But does anyone know how it works,
Does anyone know of a method to use CRTP to count the number of
Does anyone know the syntax to use to add pattern styles to the cell
Does anyone know if Raphael supports the use of a drop shadow. I am

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.