title: ERROR: cannot find symbol variable toast
body: <p>I copied the following code from a tutorial but it shows 4 errors, all same : cannot find symbol variable toast. I searched a lot for any solution but was unable to find any. Following is the MainActivity.java file of my code-</p>
  
  <pre><code>import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.net.ConnectivityManager;
  import android.content.Context;
  import android.widget.Button;
  import android.view.View;
  import android.net.NetworkInfo;
  
  
  public class MainActivity extends AppCompatActivity {
      private Button checkIntrnetButton;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          checkIntrnetButton = (Button)findViewById(R.id.checkInternetButton);
          checkIntrnetButton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  checkConnection();
              }
          });
      }
      protected boolean isOnline() {
          ConnectivityManager cm = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
          NetworkInfo netInfo = cm.getActiveNetworkInfo();
          if (netInfo != null &amp;&amp; netInfo.isConnectedOrConnecting()) {
              return true;
          } else {
              return false;
          }
      }
      public void checkConnection(){
          if(isOnline()){
              Toast.makeText(MainActivity.this, "You are connected to Internet", Toast.LENGTH_SHORT).show();
          }else{
              Toast.makeText(MainActivity.this, "You are not connected to Internet", Toast.LENGTH_SHORT).show();
          }
      }
  }
  </code></pre>