Android Question Error connecting to WIFI network


Active Member
Licensed User
Hi there,

I'm trying to connect to a WIFI network using the MLWifi400 Library and as soon as I execute:

wifi.connectWifiAP("APNAME", wifi.SECURITY_OPEN, "", 30000) ' it's a wifi network wo password

The Wifi_ConnectionResult event is called with success = True but just afte that, the program crashes and throws this error:

Wifi_ConnectionResult - Connected
b4xmainpage_alert (java line: 91)
java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
    at android.os.Handler.<init>(
    at android.os.Handler.<init>(
    at android.widget.Toast$TN.<init>(
    at android.widget.Toast.<init>(
    at android.widget.Toast.makeText(
    at anywheresoftware.b4a.keywords.Common.ToastMessageShow(
    at org.opalaconsult.miravision.api.service.b4xmainpage._alert(
    at org.opalaconsult.miravision.api.service.b4xmainpage._wifi_connectionresult(
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(
    at anywheresoftware.b4a.BA.raiseEvent(
    at com.airlinemates.mlwifi.MLwifi$2$
    at java.util.concurrent.Executors$
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(
    at java.util.concurrent.ScheduledThreadPoolExecutor$
    at java.util.concurrent.ThreadPoolExecutor.runWorker(
    at java.util.concurrent.ThreadPoolExecutor$

I've tested in Debug and Release mode.

After the crash, Android is correctly connected to the Wifi network.

Anyone experienced such a behaviour?

Thanks in advance.