toolbar - Error inflating class in Android -


i had application using actionbaractivity, made mistake of upgrading android studio version 22. i'm trying appcompatactivity work, getting error

caused by: android.view.inflateexception: binary xml file line #2: error inflating class android.support.v7.widget.toolbar 

my activity

@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_user_prefs);      toolbar = (toolbar) findviewbyid(r.id.app_bar);     setsupportactionbar(toolbar);     getsupportactionbar().sethomebuttonenabled(true);     getsupportactionbar().setdisplayhomeasupenabled(true);      getfragmentmanager().begintransaction()             .replace(r.id.content_frame, new userprefsfragment())                     .commit(); } 

my app_bar.xml

<?xml version="1.0" encoding="utf-8"?>     <android.support.v7.widget.toolbar     xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:background="@color/grey">   </android.support.v7.widget.toolbar> 

my activity layout xml

<relativelayout     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     tools:context="com.panicsystems.reemul.legalpanic.userprefsactivity">      <include         android:id="@+id/app_bar"         layout="@layout/app_bar" />      <framelayout         android:id="@+id/content_frame"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_below="@id/app_bar"/>  </relativelayout> 

i ended deleting layout app_bar , recreating it, in layout of activity changed id other layout file name. did clean , restart.


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -