Android - Prompt Dialog window when touch on Notification
android, dialog, notifications
Solution
Try this:
Intent notifyIntent = new Intent(context,YourActivityClassHere.class);
notifyIntent.setFlag(Intent.FLAG_ACTIVITY_NEW_TASK);
//UNIQUE_ID if you expect more than one notification to appear
PendingIntent intent = PendingIntent.getActivity(SimpleNotification.this, UNIQUE_ID,
notifyIntent, PendingIntent.FLAG_UPDATE_CURRENT);
- Make the PendingIntent open up one of your Activities
- Make that Activity completely transparent and open a Dialog.
IF you want to open an Activity from notification click event:
Assuming that notif is your Notification object:
Intent notificationIntent = new Intent(this.getApplicationContext(), ActivityToStart.class);
PendingIntent contentIntent = PendingIntent.getActivity(this.getApplicationContext(), 0, notificationIntent, 0);
notif.contentIntent = contentIntent;
For other assistance you can view this sample project, it will help you:
Problem
I am new to android application development. I am doing an application for my final year project. My application will remind a user for an appointment. So far I manage to show the alert on notification bar on the appointment date. My supervisor has requested to add a function, that, when a user tab on the notification bar, there will be a dialog window and show the details (Title of the appointment and the location). How do I achieve this?