setSupportActionBar (android.support.v7.widget.Toolbar) in AppCompatActivity cannot be applied to (android.widget.Toolbar) setSupportActionBar(toolbar); Not Working in Andoriod studio.
* You Are getting this Error for Toolbar.
setSupportActionBar(android.support.v7.widget.Toolbar) in AppCompatActivity cannot be applied to (android.widget.Toolbar)
setSupportActionBar(toolbar); Method Not Working.
For this Code:-
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
try this:-
Just you have to change this:
import android.widget.Toolbar;
TO
import android.support.v7.widget.Toolbar;
Now No Error.
setSupportActionBar(android.support.v7.widget.Toolbar) in AppCompatActivity cannot be applied to (android.widget.Toolbar)
setSupportActionBar(toolbar); Method Not Working.
For this Code:-
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
try this:-
Just you have to change this:
import android.widget.Toolbar;
TO
import android.support.v7.widget.Toolbar;
Now No Error.
Amazing
ReplyDeleteAmazing x2
DeleteI'm getting the below errors on android version 3.5.2. How can I fix them ?
ReplyDeleteimport android.widget.Toolbar;
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
instate of this
Deleteimport android.widget.Toolbar;
try to import this:
import android.support.v7.widget.Toolbar;
import android.support.v7.widget.Toolbar;
DeleteIn this dependency v7 is didn't recognised by my android.Will you able to help in this..
error at the place of 'v7'
ReplyDelete