Android Question Error connecting to WIFI network

mmanso

Active Member
Licensed User
Longtime User
Hi there,

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

B4X:
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:

B4X:
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>(Handler.java:200)
    at android.os.Handler.<init>(Handler.java:114)
    at android.widget.Toast$TN.<init>(Toast.java:345)
    at android.widget.Toast.<init>(Toast.java:101)
    at android.widget.Toast.makeText(Toast.java:259)
    at anywheresoftware.b4a.keywords.Common.ToastMessageShow(Common.java:421)
    at org.opalaconsult.miravision.api.service.b4xmainpage._alert(b4xmainpage.java:91)
    at org.opalaconsult.miravision.api.service.b4xmainpage._wifi_connectionresult(b4xmainpage.java:2935)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
    at com.airlinemates.mlwifi.MLwifi$2$1.run(MLwifi.java:1119)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:154)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)

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.
 
Top