-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathNotification.txt
More file actions
executable file
·39 lines (30 loc) · 1.42 KB
/
Notification.txt
File metadata and controls
executable file
·39 lines (30 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
private void notification() {
try {
views = new RemoteViews(getContext().getPackageName(),
R.layout.notification_custom);
Intent intent = new Intent(getContext().getApplicationContext(), MainActivity.class);
PendingIntent pIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
builder = new NotificationCompat.Builder(getContext())
// Dismiss Notification
.setSmallIcon(R.mipmap.ic_launcher)
.setAutoCancel(false)
.setContentIntent(pIntent)
.setOngoing(true)
.setContent(views);
views.setImageViewResource(R.id.im_background, myImageList[background_position]);
views.setTextViewText(R.id.tv_per1, mNameBoy);
views.setTextViewText(R.id.tv_per2, mNameGirl);
views.setTextViewText(R.id.tv_days, lovedays + "");
if (mAvatarBoy != null) {
Uri i = Uri.parse(mAvatarBoy);
views.setImageViewUri(R.id.im_per1, i);
}
if (mAvatarGirl != null) {
Uri i = Uri.parse(mAvatarGirl);
views.setImageViewUri(R.id.im_per2, i);
}
notificationmanager.notify(0, builder.build());
} catch (Exception e) {
}
}