I would like to create a library in order to flash the LED notification so colorful
I wrote this code in Eclips
but when I use it in B4A I get this error
how can I fix it?
Thank you and Merry Christmas
I wrote this code in Eclips
B4X:
package net.snclab.lednotificationcontrol;
import android.app.Notification;
import android.app.NotificationManager;
import android.content.Context;
import android.graphics.Color;
import anywheresoftware.b4a.BA.Author;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;
@ShortName("LedNotificationControl")
@Author("FabioG")
@Version(1.0f)
public class LedNotificationControl {
private Context mContext;
public void LedFlashColor(int A, int R, int G, int B)
{
NotificationManager nm = ( NotificationManager ) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notif = new Notification();
notif.ledARGB = Color.argb(A, R, G, B);
notif.flags = Notification.FLAG_SHOW_LIGHTS; //Notification.DEFAULT_LIGHTS;
notif.ledOnMS = 100;
notif.ledOffMS = 100;
nm.notify(0, notif);
}
public void ClearLED()
{
NotificationManager nm = ( NotificationManager ) mContext.getSystemService( Context.NOTIFICATION_SERVICE );
nm.cancel(0);
}
}
but when I use it in B4A I get this error
B4X:
java.lang.NullPointerException
Thank you and Merry Christmas
Last edited: