【问题标题】:Android: In 4.0.3 Notification.Builder is Not FoundAndroid:在 4.0.3 中未找到 Notification.Builder
【发布时间】:2012-05-28 11:24:59
【问题描述】:


在执行以下操作时,我在 4.0.3 中遇到 Class Not Found 异常。 Class<?> notifyBuilder = null; try { notifyBuilder = Class.forName("android.app.Notification.Builder"); } catch (Exception e) { e.printStackTrace(); }

请帮忙..

【问题讨论】:

  • 这可能对你有帮助 stackoverflow.com/a/10046725/1289716
  • 不应该是android.app.Notification$Builder,因为Notification是类而Builder是它的内部类?
  • @Selvin 它与 Notification$Builder 一起工作,谢谢..但它适用于 android.app.AlertDialog.Builder 奇怪的权利!!!???
  • 您是否有理由通过反射访问它?请记住,Android 支持包有 NotificationCompat.Builder,您可以使用它返回到 API 级别 4。
  • 正在尝试修复此问题..stackoverflow.com/questions/8350615/… 我的应用程序旨在从 2.2 开始运行..

标签: android


【解决方案1】:

您需要为 3.0 之前的手机下载兼容性库。您可以在此处找到更多信息:

http://developer.android.com/tools/extras/support-library.html

另外,这里有一个链接,可以帮助您了解如何使用“NotificationCompat.Builder”实现通知(注意后缀 Compat):

How exactly to use Notification.Builder

【讨论】:

    【解决方案2】:

    使用这个工作“android.app.Notification$Builder”

    【讨论】:

      【解决方案3】:

      这适用于我的 4.0.3 android 应用 web tutorial

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-03-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多