Java Android dev studio发出通知时有多行文本显示和触摸屏关闭 请使用代码块修复问题格式。重复: .setContentText("Notification content.") // content // This is my code for
Android dev studio发出通知时有多行文本显示和触摸屏关闭Java Android dev studio发出通知时有多行文本显示和触摸屏关闭 请使用代码块修复问题格式。重复: .setContentText("Notification content.") // content // This is my code for,java,android,android-intent,android-activity,android-notifications,Java,Android,Android Intent,Android Activity,Android Notifications,Android dev studio发出通知时有多行文本显示和触摸屏关闭 请使用代码块修复问题格式。重复: .setContentText("Notification content.") // content // This is my code for the content. noti.flags=Notification.FLAG_AUTO_CANCEL; // This is used for closing the notification when touched Inten
请使用代码块修复问题格式。重复:
.setContentText("Notification content.") // content
// This is my code for the content.
noti.flags=Notification.FLAG_AUTO_CANCEL; // This is used for closing the notification when touched
Intent intent = new Intent(); // create intent needed by notification
PendingIntent pIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0); // set intent as pending
// content, request code, intent, flags
Notification noti = new Notification.Builder(getApplicationContext()) // build the notification
.setTicker("ALERT") // ticker title
.setContentTitle("ALERT") // title
.setContentText("filler text text text text text text text text text text insert long sentences here")// content title
.setSmallIcon(R.drawable.ic_launcher) // notification icon
.setContentIntent (pIntent).getNotification();
noti.flags=Notification.FLAG_AUTO_CANCEL; // make flag to close notification when touched
// start notif manager
NotificationManager notificationmanager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
// display noficiation
notificationmanager.notify(0, noti); // first parameter is uniq id, second param is notif object
Also how do I make it appear in code formatting.