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