2016-06-02 5 views
-2

애플리케이션 주최자 알림을 만들었습니다. 응용 프로그램에는 미리 알림 미디어로 날짜와 시간의 시스템 작업이 있습니다. 의제가 구현 된 경우 목록보기에 알림을 보내는 방법을 의미합니까? 도와주세요. 고맙습니다.android의 목록보기에서 알림을 추가하는 방법

답변

0

정확하게 이해했다면 앱에 알림이 표시되기를 원합니다. 즉 당신이 필요, 질문을 명확히하십시오 아니라면 이렇게하려면 this tutorial

NotificationCompat.Builder mBuilder = 
     new NotificationCompat.Builder(this) 
     .setSmallIcon(R.drawable.notification_icon) 
     .setContentTitle("My notification") 
     .setContentText("Hello World!"); 
// Creates an explicit intent for an Activity in your app 
Intent resultIntent = new Intent(this, ResultActivity.class); 

// The stack builder object will contain an artificial back stack for the 
// started Activity. 
// This ensures that navigating backward from the Activity leads out of 
// your application to the Home screen. 
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); 
// Adds the back stack for the Intent (but not the Intent itself) 
stackBuilder.addParentStack(ResultActivity.class); 
// Adds the Intent that starts the Activity to the top of the stack 
stackBuilder.addNextIntent(resultIntent); 
PendingIntent resultPendingIntent = 
     stackBuilder.getPendingIntent(
      0, 
      PendingIntent.FLAG_UPDATE_CURRENT 
     ); 
mBuilder.setContentIntent(resultPendingIntent); 
NotificationManager mNotificationManager = 
    (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 
// mId allows you to update the notification later on. 
mNotificationManager.notify(mId, mBuilder.build()); 

에서 코드를보십시오.

관련 문제