日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.wifi.SCAN_RESULTS flg

發(fā)布時(shí)間:2025/3/11 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.wifi.SCAN_RESULTS flg 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.


E/AndroidRuntime: FATAL EXCEPTION: main

? ? ? ? ? ? ? ? ? Process: com.nokia.wlanapp, PID: 18526
? ? ? ? ? ? ? ? ? java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.wifi.SCAN_RESULTS flg=0x4000010 (has extras【外部】) } in com.nokia.wlanapp.Receiver.WifiReceiver@22f1b23
? ? ? ? ? ? ? ? ? ? ? at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:975)
? ? ? ? ? ? ? ? ? ? ? at android.os.Handler.handleCallback(Handler.java:815)
? ? ? ? ? ? ? ? ? ? ? at android.os.Handler.dispatchMessage(Handler.java:104)
? ? ? ? ? ? ? ? ? ? ? at android.os.Looper.loop(Looper.java:207)
? ? ? ? ? ? ? ? ? ? ? at android.app.ActivityThread.main(ActivityThread.java:5902)
? ? ? ? ? ? ? ? ? ? ? at java.lang.reflect.Method.invoke(Native Method)
? ? ? ? ? ? ? ? ? ? ? at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:945)
? ? ? ? ? ? ? ? ? ? ? at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:806)
? ? ? ? ? ? ? ? ? ?Caused by: java.lang.IllegalStateException: System services not available to Activities before onCreate()
? ? ? ? ? ? ? ? ? ? ? at android.app.Activity.getSystemService(Activity.java:5383)
? ? ? ? ? ? ? ? ? ? ? at android.widget.SimpleAdapter.<init>(SimpleAdapter.java:93)
? ? ? ? ? ? ? ? ? ? ? at com.nokia.wlanapp.view.impl.WlanListActivity.setWlanApList(WlanListActivity.java:50)
? ? ? ? ? ? ? ? ? ? ? at com.nokia.wlanapp.presenter.WlanListPresenter.getWlanApList(WlanListPresenter.java:45)
? ? ? ? ? ? ? ? ? ? ? at com.nokia.wlanapp.Receiver.WifiReceiver.onReceive(WifiReceiver.java:21)
? ? ? ? ? ? ? ? ? ? ? at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:963)
? ? ? ? ? ? ? ? ? ? ? at android.os.Handler.handleCallback(Handler.java:815)?
? ? ? ? ? ? ? ? ? ? ? at android.os.Handler.dispatchMessage(Handler.java:104)?
? ? ? ? ? ? ? ? ? ? ? at android.os.Looper.loop(Looper.java:207)?
? ? ? ? ? ? ? ? ? ? ? at android.app.ActivityThread.main(ActivityThread.java:5902)?
? ? ? ? ? ? ? ? ? ? ? at java.lang.reflect.Method.invoke(Native Method)?
? ? ? ? ? ? ? ? ? ? ? at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:945)?
? ? ? ? ? ? ? ? ? ? ? at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:806)?
I/Process: Sending signal. PID: 18526 SIG: 9

Disconnected from the target VM, address: 'localhost:8604', transport: 'socket'


問題在代碼new的問題。


WifiReceiver.java




WlanListActivity.java


WlanListPresenter.java



問題是:

廣播new出來的WlanListPresenter對象,activity頁面new出來的WlanListPresenter對象不是同一個(gè),WlanListPresenter構(gòu)造方法構(gòu)造的頁面不是new了WlanListPresenter對象的Activity頁面。所以報(bào) has extras,它們是外部的,沒有各自的聯(lián)系。 解決方法:廣播作為頁面Activity的內(nèi)部類WlanListPresenter構(gòu)造方法傳入new WlanListPresenter的Activity



總結(jié)

以上是生活随笔為你收集整理的java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.wifi.SCAN_RESULTS flg的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。