NotificationCompat.Builder builder =newNotificationCompat.Builder(this);
builder.setTicker("set Ticker");
builder.setContentTitle("Title");
builder.setContentText("Text");
builder.setSmallIcon(R.drawable.my_small_icon);

Bitmap pic =BitmapFactory.decodeResource(getResources(), R.drawable.my_96px_large_icon);
builder.setLargeIcon(pic);NotificationManager notification =(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notification.notify("direct_tag", NOTIF_ALERTA_ID, builder.build
());



利用此方法就可以設定Nitification的圖片,不然我一開始直接呼叫也無法使用。

怪獸 發表在 痞客邦 留言(0) 人氣()