0

我已经查找了有关如何使 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);
    }
4

1 回答 1

2

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

于 2011-12-19T17:41:09.357 回答