Problem I'm having:
Code in question(From MainActivity) - 4th line:
class wifi {
int signalStrength = 0;
int loopToggle = 0;
Context context = MainActivity.this;
@RequiresApi(api = Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public void loop() throws InterruptedException {
while (loopToggle == 0) {
WifiManager signalStrength = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
String wifiInfo = WifiManager.EXTRA_WIFI_INFO;
TextView textView = (TextView) textView.findViewById(R.id.readOut);
Thread.sleep(1000);
}
}
}
Thanks so much for any help! :)
The error is because you're placing the wifi
outside the MainActivity
class like this:
public class MainActivity extends AppCompatActivity {
...
}
class wifi {
...
}
wifi
class must be inside the MainActivity
class, like this:
public class MainActivity extends AppCompatActivity {
...
class wifi {
...
}
}