android - how i can intent from notification? -
why intent
notification null?
intent resultintent = new intent(context, myclass.class); resultintent.addflags(intent.flag_activity_new_task | intent.flag_activity_single_top); bundle extras=new bundle(); extras.putstring("key","value"); pendingintent resultpendingintent = pendingintent.getactivity( context, 0, resultintent, pendingintent.flag_update_current ); notificationcompat.builder n = new notificationcompat.builder(context) .setcontenttitle("test") .setcontenttext(text) .setsound(sound) .setcontentintent(resultpendingintent) .setautocancel(true) .setextras(extras) .setsmallicon(android.r.drawable.ic_media_play); notificationmanager notificationmanager = (notificationmanager) context.getsystemservice((context.getapplicationcontext().notification_service)); notificationmanager.notify(0, n.build()); }
but in onstart()
of myclass when call getintent().getextras()
result null, why? how can getextras()
notification intent ?
i think u forgot call.
resultintent.putextras(extras);
before calling it.
Comments
Post a Comment