Java 如何在android上的列表视图中添加通知
我做了一个申请组织者提醒。该应用程序具有系统工作的日期和时间作为提醒介质。我的意思是,如果议程已经实施,如何向listview发出通知?请帮忙。Java 如何在android上的列表视图中添加通知,java,android,eclipse,Java,Android,Eclipse,我做了一个申请组织者提醒。该应用程序具有系统工作的日期和时间作为提醒介质。我的意思是,如果议程已经实施,如何向listview发出通知?请帮忙。 谢谢如果我理解正确,您希望您的应用程序显示通知,对吗?要执行此操作,请尝试从 如果这不是你需要的,请澄清你的问题 NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.noti
谢谢如果我理解正确,您希望您的应用程序显示通知,对吗?要执行此操作,请尝试从 如果这不是你需要的,请澄清你的问题
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.notification_icon)
.setContentTitle("My notification")
.setContentText("Hello World!");
// Creates an explicit intent for an Activity in your app
Intent resultIntent = new Intent(this, ResultActivity.class);
// The stack builder object will contain an artificial back stack for the
// started Activity.
// This ensures that navigating backward from the Activity leads out of
// your application to the Home screen.
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
// Adds the back stack for the Intent (but not the Intent itself)
stackBuilder.addParentStack(ResultActivity.class);
// Adds the Intent that starts the Activity to the top of the stack
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent =
stackBuilder.getPendingIntent(
0,
PendingIntent.FLAG_UPDATE_CURRENT
);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// mId allows you to update the notification later on.
mNotificationManager.notify(mId, mBuilder.build());