Я новый программист в приложении Android, я хотел бы отображать несколько уведомлений одно за другим от activity. Я реализовал метод получения уведомления следующим образом
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);
}
и у меня есть использовал массив строк для отображения уведомлений в виде списка следующий код для отображения уведомлений
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();
из приведенного выше кода я хотел бы отображать список предупреждений об уведомлениях одно за другим следующим образом:
hai
как вы?
wer ru?
что происходит
как это?
........
как я могу отобразить значения массива String как уведомления в виде списка