I'm trying to make it so a custom dialog box pops up each time that I click my apps notification icon on the status bar. But I can't get it to work. Here's my notification icon code. I also don't want it to return to the main activity every time I click it.
NotificationManager nm=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification=new Notification(R.smiley_face, "Lala", System.currentTimeMillis());
Context context=MainActivity.this;
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), Notification.FLAG_ONGOING_EVENT);
notification.flags = Notification.FLAG_ONGOING_EVENT;
notification.setLatestEventInfo(this, "Smiley", "Touch for more options", contentIntent);
Intent intent=new Intent(context,MainActivity.class);
PendingIntent pending=PendingIntent.getActivity(context, 0, intent, 0);
nm.notify(0, notification);
And here is the custom dialog code. I've tried putting it in the notification icon code but it doesn't work.
CustomDialogClass cdd = new CustomDialogClass(MainActivity.this);
cdd.show();
Solved
What I ended up doing was just making the customdialog into a transparent activity and then starting it up as an intent.