Java 将android代码上的通知更改为使用notification.builder

Java 将android代码上的通知更改为使用notification.builder,java,android,notifications,Java,Android,Notifications,我不是一个开发人员,我正在尝试让一些示例代码很好地工作。 我运行的API与我使用的代码不完全兼容。(API15) 有没有人能帮我重新格式化这段代码,使之能够使用更新的样式 (我试过了,但根据链接的问题,我无法找到正确的方法) 有关更多详细信息,请使用以下链接: { Notification notification = new Notification(R.drawable.ic_launcher, "Robot service running", System.

我不是一个开发人员,我正在尝试让一些示例代码很好地工作。 我运行的API与我使用的代码不完全兼容。(API15)

有没有人能帮我重新格式化这段代码,使之能够使用更新的样式

(我试过了,但根据链接的问题,我无法找到正确的方法)

有关更多详细信息,请使用以下链接:

{           
    Notification notification = new Notification(R.drawable.ic_launcher, "Robot service running", System.currentTimeMillis());
    notification.setLatestEventInfo(this, "Robot Service", "Click to stop", PendingIntent.getService(this, 0, new Intent("stop", null, this, this.getClass()), 0));
    notification.flags |= Notification.FLAG_ONGOING_EVENT;
    nm.notify(0, notification);     
}
Notification noti = new Notification.Builder(mContext)
         .setContentTitle("New mail from " + sender.toString())
         .setContentText(subject)
         .setSmallIcon(R.drawable.new_mail)
         .setLargeIcon(aBitmap)
         .build();