title: cannot be cast to androidx.appcompat.widget.Toolbar
body: <p>My app crashes whenever I launch this activity and throws the error :</p>
  <p><strong>Caused by: java.lang.ClassCastException: android.widget.Toolbar cannot be cast to androidx.appcompat.widget.Toolbar</strong></p>
  <p>Below is my code, how can I fix this?</p>
  <pre><code>package com.example.irecipe;
  
  import androidx.appcompat.app.AppCompatActivity;
  import androidx.appcompat.widget.Toolbar;
  
  import android.os.Bundle
  
  import android.widget.TextView;
  
  public class RecipeActivity extends AppCompatActivity {
  
      Toolbar toolbar;
      TextView toolbar_title;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_recipe);
  
          toolbar = (androidx.appcompat.widget.Toolbar) findViewById(R.id.toolBar);
          setSupportActionBar(toolbar);
  
          toolbar_title = findViewById(R.id.toolBar_title);
          toolbar_title.setText(&quot;Recipe&quot;);
  
      }
  
  }
  </code></pre>