- Forum-Beiträge: 27
01.09.2014, 16:31:09 via Website
01.09.2014 16:31:09 via Website
Hallo,
ich habe folgendes Problem: ich habe mich mit Benachrichtigungen versucht und eine kleine App gemacht mit 3 Buttons die bei Benutzung eine Notification auslösen. Nun ist jedoch das Problem das egal in welcher Reihnfolge man sie drückt, das die Notification1 immer als erstes dasteh, ich jedoch will das sie in der Reihnfolge im Status-bar sind wie man sie drückt. Kann mir jemand helfen? Code im Anhang (Notification3 ist noch nicht definiert):
Danke schonmal im Vorraus
public void sendNotification(View view) {
switch(view.getId()){
case R.id.button1:
Notification1();
break;
case R.id.button2:
Notification2();
break;
case R.id.button3:
break;
}
}
private void Notification1() {
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setAutoCancel(true);
builder.setContentTitle("BasicNotification");
builder.setContentText("Test");
builder.setSmallIcon(R.drawable.icon1);
Notification notification = builder.build();
NotificationManager manager = (NotificationManager) this.getSystemService(NOTIFICATION_SERVICE);
manager.notify(1, notification);
}
private void Notification2() {
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setAutoCancel(true);
builder.setContentTitle("BasicNotification");
builder.setContentText("Test");
builder.setSmallIcon(R.drawable.icon2);
Notification notification = builder.build();
NotificationManager manager = (NotificationManager) this.getSystemService(NOTIFICATION_SERVICE);
manager.notify(2, notification);
}
}
Empfohlener redaktioneller Inhalt
Mit Deiner Zustimmung wird hier ein externer Inhalt geladen.
Mit Klick auf den oben stehenden Button erklärst Du Dich damit einverstanden, dass Dir externe Inhalte angezeigt werden dürfen. Dabei können personenbezogene Daten an Drittanbieter übermittelt werden. Mehr Infos dazu findest Du in unserer Datenschutzerklärung.