2017-01-01 3 views
0

Androidで通知を行っていて、大きなビュー通知を作成しようとしていましたimはNotificationCompat.BuilderオブジェクトsetStyleを呼び出してNotificationCompat.inboxStyleオブジェクトを渡します。Androidでプログラミングしているときにエラーが発生しました:互換性のないタイプ:InboxStyeをスタイルに変換できません

Error:(50, 39) error: incompatible types: InboxStyle cannot be converted to Style 

は、ここに私のコードです:

Uri uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM); 
notification.setSmallIcon(R.mipmap.ic_launcher);  //displays the icon for the notification 
NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle(); 
String[] events = new String[4]; 
events[0]= new String("First event"); 
events[1]= new String("Second event"); 
events[2]= new String("Third event"); 
events[3]= new String("Fourth event"); 

inboxStyle.setBigContentTitle("This is a big Content Notification"); 
for(int i = 0; i<events.length;i++) 
    inboxStyle.addLine(events[i]); 
notification.setStyle(inboxStyle); //here is the error 
notification.setSound(uri); 

Intent intent = new Intent(); 
PendingIntent pendingIntent = PendingIntent.getActivity(MainActivity.this,0,intent,PendingIntent.FLAG_UPDATE_CURRENT); 
notification.setContentIntent(pendingIntent); 

NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); 
notificationManager.notify(uniqueID,notification.build()); 

答えて

0

あなたは「通知」のあなたの宣言を示さなかったので、言うのは少し難しいです。ただし、すべての書類はこの書式で提出することをお勧めします。

Notification notification = mBuilder.setSmallIcon(icon).setTicker("title").setWhen(0) 
      ... 
      .setStyle(inboxStyle) 
      ...     
       .build(); 
関連する問題