How Android notification bar click event : I want by clicking on the notification bar, a bar displays a dialog box ?
I know you can jump to an Activity, but could not find a way to display the dialog box , I was a novice , seek expert guidance !
------ Solution ---------------------------------------- ----
can set a PedingIntent.
------ Solution ---------------------------------------- ----
be transparent Activity simulated dialog.
------ Solution ---------------------------------------- ----
can do very Activity dialog same. In the manifest is set to Activity Dialog style , too.
android: theme = "@ android: style / Theme.Dialog"
------ eference --------------------- ------------------
buddy what progress it is now seeking the same ah
------ eference ------ ---------------------------------
/ ** initialize the notification bar
*
* /
public void createNotification (String content, String push_time) {
if (updateNotificationManager == null) {
this.updateNotificationManager = (NotificationManager) getSystemService (NOTIFICATION_SERVICE);
}
if (updateNotification == null) {
this.updateNotification = new Notification ();
}
Intent notificationIntent = null;
PendingIntent contentIntent = null;
if (content! = null) {
if (notificationIntent == null | | contentIntent == null) {
notificationIntent = new Intent (this, StartActivity.class); / / click on the notification to jump Activity
notificationIntent.setFlags (Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_NEW_TASK);
contentIntent = PendingIntent.getActivity (this, 0, notificationIntent, 0);
}
updateNotification.icon = R.drawable.notification_icon ;/ / set the icon in the notification bar
updateNotification.tickerText = content ;/ / set the notification bar content
updateNotification.defaults | = Notification.DEFAULT_SOUND ;/ / set the notification bar to notify tone
updateNotification.setLatestEventInfo (this, this.getResources () getString (R.string.software_name), content, contentIntent.);
/ / passed to the Notification NotificationManager
updateNotificationManager.notify (0, updateNotification);
/ / if (updateNotificationManager! = null) {
/ / updateNotificationManager.cancelAll ();
/ /}
}
}
------ eference ----------------------------------- ----
pendingaction registered as a broadcast message , creating a dialog
------ eference in which the broadcast receiver ------------------ ---------------------
specifically how to do ?
没有评论:
发表评论