1
OFFICIAL ANDROID DOCUMENTATION ABOUT TOOLBAR
I’m following the official documentation of Android, and even so I’m having problems as it generated this error.
Caused by: android.view.Inflateexception: Binary XML file line #9 in com.resource.actionbar:layout/activity_main: Binary XML file line #5 in com.resource.actionbar:layout/Toolbar: Error inflating class android.support.v7.widget.Toolbar Caused by: android.view.Inflateexception: Binary XML file line #5 in com.resource.actionbar:layout/Toolbar: Error inflating class android.support.v7.widget.Toolbar Caused by: java.lang.Classnotfoundexception: android.support.v7.widget.Toolbar at java.lang.Class.classForName(Native Method)
I follow all recommendations This is my Activity.
package com.resource.actionbar;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toolbar;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
setActionBar(myToolbar);
}
}
I tried to change this one android.widget.Toolbar for this androidx.appcompat.widget.Toolbar and it still didn’t work! I need help!
You could also post the XML layout of this App, by your Stacktracer I believe the problem is there, but I need to confirm to be sure.
– Brendon Iwata