I'm encountering an issue when trying to open an intent with WifiNetworkSuggestion in my Android app. Whenever I call the startOperation() function, I get a Resources$NotFoundException with the following error message:
Drawable com.android.settings:drawable/ic_wifi_signal_0 with resource ID #0x7f080952
Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 0: TypedValue{t=0x2/d=0x7f040875 a=-1}, theme={InheritanceMap=[id=0x7f13059acom.android.settings:style/Theme.Panel, id=0x1030403android:style/Theme.DeviceDefault.Settings.Dialog, id=0x1030407android:style/Theme.DeviceDefault.Settings.DialogBase, id=0x1030438android:style/Theme.Material.Light.BaseDialog, id=0x1030237android:style/Theme.Material.Light, id=0x103000candroid:style/Theme.Light, id=0x1030005android:style/Theme], Themes=[com.android.settings:style/Theme.Panel, forced, android:style/Theme.DeviceDefault.Light.DarkActionBar, forced]}
It seems to be related to a drawable resource ic_wifi_signal_0 in the com.android.settings package, but I'm unable to resolve it. The error mentions a failed attribute resolution with a specific TypedValue and theme information.
I'm using the startOperation() function to add WiFi network suggestions through an ACTION_WIFI_ADD_NETWORKS intent. The code snippet I'm using is as follows:
kotlin Copy code
@RequiresApi(Build.VERSION_CODES.R)
fun startOperation() {
val suggestions = ArrayList<WifiNetworkSuggestion>()
suggestions.add(WifiNetworkSuggestion.Builder().setSsid(ifeRougeWifiSsid).build())
suggestions.add(WifiNetworkSuggestion.Builder().setSsid(ifeAcWifiSsid).build())
val bundle = Bundle()
bundle.putParcelableArrayList(EXTRA_WIFI_NETWORK_LIST, suggestions)
val intent = Intent(ACTION_WIFI_ADD_NETWORKS)
intent.putExtras(bundle)
launcher.launch(intent)
}
I've checked that the ifeRougeWifiSsid and ifeAcWifiSsid variables are properly initialized.
I would appreciate any insights or suggestions on how to resolve this issue. Thank you!