I implemented the code to check wifi state connected or not. I made a text view
TextView WifiTv = (TextView) findViewById(R.id.wifistate);
    ConnectivityManager connectionManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo wifiCheck = connectionManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
    if (wifiCheck.isConnected()) {
        // Do whatever here
        WifiTv.setText("WiFi is Connected");
        WifiTv.notify();
    } else {
        WifiTv.setText("WiFi is not Connected");
    }
It works but it does not update dynamically and therefore if I turn off wifi I have to refresh the activity for the textview to change (not data binded). How can I make the textview update without refresh please? Thx
EDIT: I have this code in a seperate class which works well with a toast. All I want to do is display in textview instead. How can I connect the textview variable to this class which does not have xml please?
public void onReceive(Context context, Intent intent) {
    NetworkInfo info =
            intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
    if (info != null && info.isConnected()) {
        // Do your work.
        // e.g. To check the Network Name or other info:
        WifiManager wifiManager = (WifiManager)
                context.getSystemService(Context.WIFI_SERVICE);
        WifiInfo wifiInfo = wifiManager.getConnectionInfo();
        String ssid = wifiInfo.getSSID();
        Toast.makeText(context, "Connected to: " + ssid,
                Toast.LENGTH_SHORT).show();
    }
 
     
     
    