推送通知在自定义布局上抛出错误

时间:2016-06-07 09:27:13

标签: android notifications

出于任何我不知道的原因,我收到以下错误。

AppCompatDelegate: The Activity's LayoutInflater already has a Factory installed so we can not install AppCompat

  RemoteViews mContentView = new RemoteViews(getPackageName(),R.layout.custom_layout);
  mContentView.setTextViewText(R.id.notiftitle, message); 
  Notification notification = new Notification.Builder(
                getApplicationContext()).setContent(mContentView).
                setAutoCancel(true).setContentIntent(pIntent).setSound(alertSound).
                setContentTitle(getResources()
               .getString(R.string.app_name)).getNotification();
        // Remove the notification on click
        // notification.flags |= Notification.FLAG_AUTO_CANCEL;
        Random r = new Random();
        int i1 = r.nextInt(100000000 - 0) + 0;
        NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
        manager.notify(i1, notification);

0 个答案:

没有答案