title: getNetworkInfo() is deprecated in Android Studio using API 23
body: <p>I have a problem in my code. I am following a tutorial and it's using an old API.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>package com.flax.security;
  
  import android.content.Context;
  import android.net.ConnectivityManager;
  import android.os.Bundle;
  import android.support.v7.app.AppCompatActivity;
  import android.widget.TextView;
  
  public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
  
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          ConnectivityManager conman = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
          TextView tv = (TextView) findViewById(R.id.mytextview);
  
          boolean wifi = conman.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnectedOrConnecting();
  
          if(wifi) {
              tv.setText("This wifi is on!");
          } else {
              tv.setText("The wifi is off!");
          }
  
  
      }
  }
  </code></pre>
  
  <p>My error says that <code>getNetworkInfo</code> is already depracated. How can I resolve this? I am new in Android Development.</p>