2011-12-19 92 views
0

我查找了有关如何让android设备LED闪烁并收到关于无法将LED_NOTIFICATION_ID解析为变量的消息的示例。我的代码如下。有没有人能告诉我为什么我收到这个错误?Android 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); 
    } 

回答

2

您还没有将LED_NOTIFICATION_ID声明为变量。寻找拼写错误。它应该是合格的类名?

+1

基于我看到的例子,我认为它是一个内置变量。它没有在代码中定义。谢谢你的帮助! – 2011-12-19 18:40:46

+0

只需使用1。 – mircobabini 2014-02-21 10:11:20