【问题标题】:Android LED_NOTIFICATION_ID cannot be resolved to a variableAndroid LED_NOTIFICATION_ID 无法解析为变量
【发布时间】:2011-12-19 17:36:43
【问题描述】:

我查找了有关如何使 android 设备 LED 闪烁的示例,并且收到了有关无法将 LED_NOTIFICATION_ID 解析为变量的消息。我的代码如下。有没有人可以告诉我为什么我会收到这个错误?

private void redFlashLight(Context context)
    {
        NotificationManager nm = ( NotificationManager ) context.getSystemService( context.NOTIFICATION_SERVICE );
        Notification notif = new Notification();
        notif.ledARGB = 0xFFff0000;
        notif.flags = Notification.FLAG_SHOW_LIGHTS;
        notif.ledOnMS = 100; 
        notif.ledOffMS = 100; 
        notif.flags = Notification.FLAG_SHOW_LIGHTS | Notification.FLAG_ONLY_ALERT_ONCE;
        nm.notify(LED_NOTIFICATION_ID, notif);
    }

【问题讨论】:

    标签: android notifications led


    【解决方案1】:

    那时您还没有将LED_NOTIFICATION_ID 声明为变量。寻找拼写错误。它应该用类名来限定吗?

    【讨论】:

    • 根据我看到的例子,我假设它是一个内置变量。他们的代码中没有定义。感谢您的帮助!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-23
    • 1970-01-01
    相关资源
    最近更新 更多