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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:43:43+00:00 2026-05-22T22:43:43+00:00

I need to create multiple statusbar notifications. When i pull down the statusbar, multiple

  • 0

I need to create multiple statusbar notifications. When i pull down the statusbar, multiple notification icons should be displayed as a list. Each notification icon should show separate data to display on next page.How could i do this?

My code:

public class SimpleNotification extends Activity {

private NotificationManager mNotificationManager;
private int SIMPLE_NOTFICATION_ID;

String str="Hai";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mNotificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
    final Notification notifyDetails = new Notification(R.drawable.android,"New Alert, Click Me!",System.currentTimeMillis());


    Button start = (Button)findViewById(R.id.notifyButton);
    Button cancel = (Button)findViewById(R.id.cancelButton);



        start.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {


            Context context = getApplicationContext();
            CharSequence contentTitle = "Notification Details...";
            CharSequence contentText = "Browse Android Official Site by clicking me";
            Intent notifyIntent = new Intent(SimpleNotification.this,
                    sub.class);

            Bundle bundle = new Bundle();
            bundle.putString("welcome",str);
            notifyIntent.putExtras(bundle);

            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);
        }
    });

Here I did for one notification, but I need to create multiple notifications that each notification should show each data.

  • 1 1 Answer
  • 3 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-22T22:43:44+00:00Added an answer on May 22, 2026 at 10:43 pm

    You need to pass a unique ID to each notification. Once you have clicked on the notification you use that ID to remove it.

    public class SimpleNotification extends Activity {
    
        private NotificationManager mNotificationManager;
        private int SIMPLE_NOTFICATION_ID_A = 0;
        private int SIMPLE_NOTFICATION_ID_B = 1;
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    
            Button start = (Button) findViewById(R.id.start_button);        
    
            start.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                    // display A
                    displayNotification("Extra for A", "This is A", "Some text for activity A", MyActivityA.class, SIMPLE_NOTFICATION_ID_A);
                    // display B
                    displayNotification("Extra for B", "This is B", "Some text for activity B", MyActivityB.class, SIMPLE_NOTFICATION_ID_B);
                }
            });
        }
    
        private void displayNotification(String extra, String contentTitle, String contentText, Class<?> cls, int id) {     
            Notification notifyDetails = new Notification(R.drawable.icon, "New Alert!", System.currentTimeMillis());
            Intent intent = new Intent(this, cls);
            intent.putExtra("extra", extra);
            PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(), id, intent, PendingIntent.FLAG_ONE_SHOT);
            notifyDetails.setLatestEventInfo(getApplicationContext(), contentTitle, contentText, contentIntent);
            mNotificationManager.notify(id, notifyDetails);
        }
    }
    

    MyActivityA – in onCreate()

    ...
    mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    mNotificationManager.cancel(SIMPLE_NOTFICATION_ID_A);
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create multiple records in sqlserver, each with the same value in
I have a need to create multiple processing threads in a new application. Each
I need to create multiple search fields that each search different content in WordPress.
I need to create a batch file which starts multiple console applications in a
I need to create an XmlDocument with a root element containing multiple namespaces. Am
I need to create multiple /testcontainer: parameters to feed into a task that exec's
I need to create multiple threads when a button is clicked and i've done
Why do I need to create Multiple SSPs in MOSS? My manager (sharepoint administrator)
i need to create multiple javascript functions which have a static id inside, so
I need to create multiple actions for a gridview - say, Approve, Deny, 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.