title: what is the reason android.support.v7.widget.Toolbar cannot be cast to android.widget.Toolbar
body: <p>I get this error </p>
  
  <pre><code> Caused by: java.lang.ClassCastException: android.support.v7.widget.Toolbar cannot be cast to android.widget.Toolbar
  </code></pre>
  
  <p>I use this import <code>import android.support.v7.widget.Toolbar;</code></p>
  
  <p>this is code of toolbar</p>
  
  <pre><code>@Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      Toolbar tb=(Toolbar)findViewById(R.id.toolbar);
      tb.inflateMenu(R.menu.main);
      tb.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClick(MenuItem item) {
              return (onOptionsItemSelected(item));
          }
      });
    //  getMenuInflater().inflate(R.menu.main, menu);
     // return true;
      return(super.onCreateOptionsMenu(menu));
  }
  </code></pre>