我有这个代码:
Notification notif;
// Build notification
Notification.Builder notifBuilder = new Notification.Builder(context);
notifBuilder.setContentIntent(pendingIntent);
notifBuilder.setContentTitle(title);
notifBuilder.setSmallIcon(icon_resId);
notifBuilder.setContentText(ne.getCaption());
notifBuilder.setDefaults(Notification.DEFAULT_ALL);
notifBuilder.setAutoCancel(autocancel);
notifBuilder.setWhen(System.currentTimeMillis());
notif = notifBuilder.build();
Run Code Online (Sandbox Code Playgroud)
在Android 4.4中运行良好.
但是,在Android 5.0中,状态栏中显示的图标是白色方块.设备锁定时显示的新"通知正文"中显示的图标是正确的.
在http://developer.android.com/reference/android/app/Notification.Builder.html中,我没有看到有关API级别21的通知图标的任何新内容
notifications android android-notification-bar android-5.0-lollipop
我有这个代码,在Android 4.4和之前的版本中工作正常:
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setPackage("com.android.phone");
intent.setData(Uri.parse("tel:" + number));
context.startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
现在,在Android 5.0 Lollipop中,此代码不起作用,并显示此异常:
Fatal Exception: android.content.ActivityNotFoundException
No Activity found to handle Intent { act=android.intent.action.CALL dat=tel:xxxxxxxxx pkg=com.android.phone }
Run Code Online (Sandbox Code Playgroud)
在文档中,这Intent似乎不被弃用:
任何的想法?提前致谢
android ×2