0

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.

Community
  • 1
  • 1
Fernando
  • 450
  • 1
  • 7
  • 22

1 Answers1

0

Open Activity as Dialog using this tag

<activity android:theme="@android:style/Theme.Dialog">
vinay
  • 90
  • 7
  • Your comment gave me an idea to make it work and therefore it was the closest thank you. What I did was just make the custom dialog into a transparent activity. – Fernando Nov 20 '13 at 19:18