New to basic4ppc and trying to help my son add a feature he needs for a project.
Need to enable Wifi Hotspot mode. Found some simple code that dynamically loads the hidden class needed to control hotspot on/off.
I have the code in a library but the library needs context and couldn't figure out how to instantiate the class with Context. I added in an initialize method.
Get the following error
Wifi.initialize(Me)
javac 1.7.0_13
src\b4a\example\main.java:366: error: inconvertible types
mostCurrent._wifi.initialize((android.content.Context)(main.getObject()));
^
required: Context
found: Class<CAP#1>
where CAP#1 is a fresh type-variable:
CAP#1 extends Object from capture of ?
Need to enable Wifi Hotspot mode. Found some simple code that dynamically loads the hidden class needed to control hotspot on/off.
I have the code in a library but the library needs context and couldn't figure out how to instantiate the class with Context. I added in an initialize method.
B4X:
Dim Wifi As WifiApManager
In ActivityCreate
If FirstTime Then
Wifi.initialize(Me)
End If
Get the following error
Wifi.initialize(Me)
javac 1.7.0_13
src\b4a\example\main.java:366: error: inconvertible types
mostCurrent._wifi.initialize((android.content.Context)(main.getObject()));
^
required: Context
found: Class<CAP#1>
where CAP#1 is a fresh type-variable:
CAP#1 extends Object from capture of ?
B4X:
public class WifiApManager {
private WifiManager mWifiManager;
public WifiApManager(){
}
public WifiApManager(Context context) {
mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
}
public void initialize(Context context){
mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
}
}