1
알림에서 URI의 맞춤 이미지를 추가 할 가능성이 있습니까? 예를 들어 : 내가 대신 드로어 블 리소스에서 URI에서 이미지를 삽입합니다Android 알림
Notification notification = new Notification(R.drawable.ic_launcher, "something", System.currentTimeMillis());
. 사전
알림에서 URI의 맞춤 이미지를 추가 할 가능성이 있습니까? 예를 들어 : 내가 대신 드로어 블 리소스에서 URI에서 이미지를 삽입합니다Android 알림
Notification notification = new Notification(R.drawable.ic_launcher, "something", System.currentTimeMillis());
. 사전
에서 덕분에 Notiifcation Builder에서 위의 코드이 코드를
// Large icon for notification with add a custom image from URI
Bitmap bmp=BitmapFactory.decodeStream(getContentResolver().openInputStream(uri));
builder.setLargeIcon(bmp);
을보십시오.
public void DisplayNotification() {
// Use NotificationCompat.Builder to set up our notification.
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
//icon appears in device notification bar and right hand corner of notification
builder.setSmallIcon(R.drawable.ic_stat_notification);
// This intent is fired when notification is clicked
Intent tapIntent = new Intent(CurrentActivity.this, SecondActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, tapIntent, 0);
// Set the intent that will fire when the user taps the notification.
builder.setContentIntent(pendingIntent);
// Large icon appears on the left of the notification
Bitmap bmp=BitmapFactory.decodeStream(getContentResolver().openInputStream(uri));
builder.setLargeIcon(bmp);
// Content title, which appears in large type at the top of the notification
builder.setContentTitle("Notifications Title");
// Content text, which appears in smaller text below the title
builder.setContentText("Your notification content here.");
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
// Will display the notification in the notification bar
notificationManager.notify(NOTIFICATION_ID, builder.build());
}
해피 코딩 :)
Notification.Builder'은 (apilevel은> 11), 당신은 어떤'Bitmap'를 사용할 수있는'사용하여 큰 아이콘으로 : http://developer.android.com/reference /android/app/Notification.Builder.html – dst
내 대답이 문제를 해결하면 완벽하게 – Mark
감사합니다. 내 대답에 동의 함을 표시해주세요. 감사. –