0
模拟器不会让我运行它,因为它出现的错误我不能运行我的Android通知,因为它出现的错误
public void onClick(View v) {
Intent intent = new Intent();
PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);
Notification noti = new Notification.Builder(this)
.setTicker("Ticker Title")
.setContentTitle("Content Title")
.setContentText("Notification content.")
.setSmallIcon(R.drawable.ic_launcher)
.setContentIntent(pIntent);
noti.flags=Notification.FLAG_AUTO_CANCEL;
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(0, noti);
}
错误消息可能会有所帮助。 –
嗨,你似乎是StackOverflow的新手。当您发布问题并说出错时,请确保您包含错误消息,例外名称,并指出它发生在哪条线上。这将有助于那些试图想出答案的人。 – mason