java - My Action bar menu is not display in another activity but it display in the main Activity only(i'm using Fragment and non Fragment) -


in android studio beginner,i learn internet tutorial i'm using navigation drawer no action bar create own action bar , i'm using fragment when mix without fragment action bar display out actionbar menu items except main activity. here .xml file below

<include     android:layout_height="wrap_content"     android:layout_width="match_parent"     layout="@layout/toolbar_layout"     />  <textview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:textappearance="?android:attr/textappearancelarge"     android:text="large text"     android:id="@+id/textview"     android:layout_alignparentleft="true"     android:layout_alignparentstart="true"     android:layout_margintop="137dp" />  </relativelayout> 

and here java file below

    public class grade_book extends appcompatactivity {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.grade_book);     }     @override     public boolean oncreateoptionsmenu(menu menu) {       getmenuinflater().inflate(r.menu.menu_grade,menu);         return true;     }  } 

you should include toolbar (the 1 include tag) in .xml files of other activities also. layout or ui of each activity defined respective .xml file , not other activities.


Comments