android - Open Dialog from Notification -
i have notification displayed. want happen:
when click on notification, open dialog, print 1 string.
now, can't work out, here, when create notification:
... intent notificationintent = new intent(context, {how open dialog}); ... then 1 button, example "ok", close dialog.
please, me.
thanks.
i in 1 of apps. in notification need this:
pendingintent contentintent = pendingintent.getactivity(context, 0, new intent("com.yourcompany.yourapp.mainactivity").putextra("fromnotification", true); inside main activity use onresume() method check extra:
@override public void onresume() { super.onresume(); if (getactivity().getintent().getbooleanextra("fromnotification", false) == true) { getactivity().getintent().removeextra("fromnotification"); startactivityforresult( new intent("com.yourcompany.yourapp.dialogactivity"), 123); } } this code displays activity dialog style, there no reason why can't create dialog inside if statement though.
Comments
Post a Comment