Click here to Skip to main content
15,886,823 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am new programmer in android application and I would like to display multiple notifications one by one from activity. I have implemented a method to get the notification as follows
C#
public void myNotify(String message) {
    Log.v("my notification method","from GetNotification class");
    NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    Notification notification = new Notification(R.drawable.icon,
            "check the notification", System.currentTimeMillis());
    // Hide the notification after its selected
    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    Intent intent = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse(""));
    PendingIntent activity = PendingIntent.getActivity(this, 0, intent, 0);
    notification.setLatestEventInfo(this, message,
            "for more info run ur app", activity);
    notification.number += 1;
    notificationManager.notify(0, notification);

}
and I have used a string array to display the notifications as a list the following code for display notifications
C#
String[] msg={"hai","how are you?","wer r u?","what is going on",
              "how is this?","let we talk?","nothing is there","hahaha"};
Thread rt=new Thread(new Runnable() {
    @Override
    public void run() {
        try {
            for(int i1=0;i1<msg.length;i1++){
                Log.v("", "thread running"+i1);
                myNotify(msg[i1]);
                Thread.sleep(5000);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
});
rt.start();

From above code I would like to display notifications alerts list one by one as follows:
hai
how are you?
wer r u?
what is going on
how is this?
........

How can I display the String array values as notifications as list?
Posted
Updated 29-Jul-11 23:52pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900