Error [android.support.v7.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference]...












-1
















This question already has an answer here:




  • What is a NullPointerException, and how do I fix it?

    12 answers




I am trying to add a navigation drawer in my application but while i am trying that it shows the following error but if i have commented " getSupportActionBar().setDisplayHomeAsUpEnabled(true);" this line then it won't show any error.



android.support.v7.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference


here is my java code



import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;

public class drawer extends AppCompatActivity {
private DrawerLayout mDrawer;
private ActionBarDrawerToggle mToggle;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_drawer);
mDrawer = (DrawerLayout) findViewById(R.id.drawer);
mToggle = new ActionBarDrawerToggle(this,mDrawer,R.string.Open,R.string.Close);
mDrawer.addDrawerListener(mToggle);
mToggle.syncState();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}


@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (mToggle.onOptionsItemSelected(item))
{
return true;
}
return super.onOptionsItemSelected(item);
}


}


here is my activity_drawer.xml



<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/drawer"
tools:context=".drawer">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"></LinearLayout>

<android.support.design.widget.NavigationView
app:headerLayout="@layout/header_drawer"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
app:itemTextColor="@color/grey"
app:itemIconTint="@color/grey"
app:menu="@menu/menudrawer"
android:layout_gravity="start">

</android.support.design.widget.NavigationView>

</android.support.v4.widget.DrawerLayout>









share|improve this question















marked as duplicate by Fantômas android
Users with the  android badge can single-handedly close android questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 16 '18 at 12:28


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • by any chance your app theme is extending from AppCompat.NoActionBar?

    – Karan Mer
    Nov 16 '18 at 9:35
















-1
















This question already has an answer here:




  • What is a NullPointerException, and how do I fix it?

    12 answers




I am trying to add a navigation drawer in my application but while i am trying that it shows the following error but if i have commented " getSupportActionBar().setDisplayHomeAsUpEnabled(true);" this line then it won't show any error.



android.support.v7.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference


here is my java code



import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;

public class drawer extends AppCompatActivity {
private DrawerLayout mDrawer;
private ActionBarDrawerToggle mToggle;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_drawer);
mDrawer = (DrawerLayout) findViewById(R.id.drawer);
mToggle = new ActionBarDrawerToggle(this,mDrawer,R.string.Open,R.string.Close);
mDrawer.addDrawerListener(mToggle);
mToggle.syncState();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}


@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (mToggle.onOptionsItemSelected(item))
{
return true;
}
return super.onOptionsItemSelected(item);
}


}


here is my activity_drawer.xml



<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/drawer"
tools:context=".drawer">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"></LinearLayout>

<android.support.design.widget.NavigationView
app:headerLayout="@layout/header_drawer"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
app:itemTextColor="@color/grey"
app:itemIconTint="@color/grey"
app:menu="@menu/menudrawer"
android:layout_gravity="start">

</android.support.design.widget.NavigationView>

</android.support.v4.widget.DrawerLayout>









share|improve this question















marked as duplicate by Fantômas android
Users with the  android badge can single-handedly close android questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 16 '18 at 12:28


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • by any chance your app theme is extending from AppCompat.NoActionBar?

    – Karan Mer
    Nov 16 '18 at 9:35














-1












-1








-1









This question already has an answer here:




  • What is a NullPointerException, and how do I fix it?

    12 answers




I am trying to add a navigation drawer in my application but while i am trying that it shows the following error but if i have commented " getSupportActionBar().setDisplayHomeAsUpEnabled(true);" this line then it won't show any error.



android.support.v7.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference


here is my java code



import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;

public class drawer extends AppCompatActivity {
private DrawerLayout mDrawer;
private ActionBarDrawerToggle mToggle;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_drawer);
mDrawer = (DrawerLayout) findViewById(R.id.drawer);
mToggle = new ActionBarDrawerToggle(this,mDrawer,R.string.Open,R.string.Close);
mDrawer.addDrawerListener(mToggle);
mToggle.syncState();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}


@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (mToggle.onOptionsItemSelected(item))
{
return true;
}
return super.onOptionsItemSelected(item);
}


}


here is my activity_drawer.xml



<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/drawer"
tools:context=".drawer">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"></LinearLayout>

<android.support.design.widget.NavigationView
app:headerLayout="@layout/header_drawer"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
app:itemTextColor="@color/grey"
app:itemIconTint="@color/grey"
app:menu="@menu/menudrawer"
android:layout_gravity="start">

</android.support.design.widget.NavigationView>

</android.support.v4.widget.DrawerLayout>









share|improve this question

















This question already has an answer here:




  • What is a NullPointerException, and how do I fix it?

    12 answers




I am trying to add a navigation drawer in my application but while i am trying that it shows the following error but if i have commented " getSupportActionBar().setDisplayHomeAsUpEnabled(true);" this line then it won't show any error.



android.support.v7.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference


here is my java code



import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;

public class drawer extends AppCompatActivity {
private DrawerLayout mDrawer;
private ActionBarDrawerToggle mToggle;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_drawer);
mDrawer = (DrawerLayout) findViewById(R.id.drawer);
mToggle = new ActionBarDrawerToggle(this,mDrawer,R.string.Open,R.string.Close);
mDrawer.addDrawerListener(mToggle);
mToggle.syncState();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}


@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (mToggle.onOptionsItemSelected(item))
{
return true;
}
return super.onOptionsItemSelected(item);
}


}


here is my activity_drawer.xml



<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/drawer"
tools:context=".drawer">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"></LinearLayout>

<android.support.design.widget.NavigationView
app:headerLayout="@layout/header_drawer"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
app:itemTextColor="@color/grey"
app:itemIconTint="@color/grey"
app:menu="@menu/menudrawer"
android:layout_gravity="start">

</android.support.design.widget.NavigationView>

</android.support.v4.widget.DrawerLayout>




This question already has an answer here:




  • What is a NullPointerException, and how do I fix it?

    12 answers








android nullpointerexception android-drawer






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 12:28









Fantômas

32.8k156491




32.8k156491










asked Nov 16 '18 at 9:24









vst dellvst dell

96




96




marked as duplicate by Fantômas android
Users with the  android badge can single-handedly close android questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 16 '18 at 12:28


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Fantômas android
Users with the  android badge can single-handedly close android questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 16 '18 at 12:28


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • by any chance your app theme is extending from AppCompat.NoActionBar?

    – Karan Mer
    Nov 16 '18 at 9:35



















  • by any chance your app theme is extending from AppCompat.NoActionBar?

    – Karan Mer
    Nov 16 '18 at 9:35

















by any chance your app theme is extending from AppCompat.NoActionBar?

– Karan Mer
Nov 16 '18 at 9:35





by any chance your app theme is extending from AppCompat.NoActionBar?

– Karan Mer
Nov 16 '18 at 9:35












4 Answers
4






active

oldest

votes


















0














please add



<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="@color/colorPrimary"
android:minHeight="?android:attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:title="@string/dashboard" />


instead of



<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"></LinearLayout>


and add this in your activity



Toolbar toolbar = findViewById(R.id.toolbar);

if (getSupportActionBar()!=null){
setSupportActionBar(toolbar);
}


also, add these to your theme



 <style name=" Your Style">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
</style>





share|improve this answer
























  • it worked thank you so much

    – vst dell
    Nov 16 '18 at 9:39











  • but the tool bar is not showing up i need to manually click and drag the drawer why is that?

    – vst dell
    Nov 16 '18 at 9:47











  • @vstdell please go through this tutorials

    – Basi
    Nov 16 '18 at 10:29



















0














Try this code..
add style into style.xml



    <style name="NoActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
</style>


pass in android manifest into activity..



        <activity android:name=".MainActivity"
android:theme="@style/NoActionBar">





share|improve this answer































    0














    In your styles.xml use



    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    </style>



    Or provide a toolbar in layout and setSupportActionBar from activity if you want use



    Theme.AppCompat.Light.NoActionBar






    share|improve this answer































      0














      I think you are missing toolbar in your xml. And you are also missing to set the toolbar in your code..



      Toolbar toolbar = findViewById(R.id.toolbar);
      setSupportActionBar(toolbar);




      <android.support.v7.widget.Toolbar
      android:id="@+id/toolbar"
      android:layout_width="match_parent"
      android:layout_height="?android:attr/actionBarSize"
      android:background="@color/colorPrimary"
      android:minHeight="?android:attr/actionBarSize"
      android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
      local:popupTheme="@style/ThemeOverlay.AppCompat.Light"
      local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
      local:title="@string/dashboard" />





      share|improve this answer
































        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        0














        please add



        <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?android:attr/actionBarSize"
        android:background="@color/colorPrimary"
        android:minHeight="?android:attr/actionBarSize"
        android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
        app:title="@string/dashboard" />


        instead of



        <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"></LinearLayout>


        and add this in your activity



        Toolbar toolbar = findViewById(R.id.toolbar);

        if (getSupportActionBar()!=null){
        setSupportActionBar(toolbar);
        }


        also, add these to your theme



         <style name=" Your Style">
        <item name="android:windowActionBar">false</item>
        <item name="android:windowNoTitle">true</item>
        </style>





        share|improve this answer
























        • it worked thank you so much

          – vst dell
          Nov 16 '18 at 9:39











        • but the tool bar is not showing up i need to manually click and drag the drawer why is that?

          – vst dell
          Nov 16 '18 at 9:47











        • @vstdell please go through this tutorials

          – Basi
          Nov 16 '18 at 10:29
















        0














        please add



        <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?android:attr/actionBarSize"
        android:background="@color/colorPrimary"
        android:minHeight="?android:attr/actionBarSize"
        android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
        app:title="@string/dashboard" />


        instead of



        <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"></LinearLayout>


        and add this in your activity



        Toolbar toolbar = findViewById(R.id.toolbar);

        if (getSupportActionBar()!=null){
        setSupportActionBar(toolbar);
        }


        also, add these to your theme



         <style name=" Your Style">
        <item name="android:windowActionBar">false</item>
        <item name="android:windowNoTitle">true</item>
        </style>





        share|improve this answer
























        • it worked thank you so much

          – vst dell
          Nov 16 '18 at 9:39











        • but the tool bar is not showing up i need to manually click and drag the drawer why is that?

          – vst dell
          Nov 16 '18 at 9:47











        • @vstdell please go through this tutorials

          – Basi
          Nov 16 '18 at 10:29














        0












        0








        0







        please add



        <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?android:attr/actionBarSize"
        android:background="@color/colorPrimary"
        android:minHeight="?android:attr/actionBarSize"
        android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
        app:title="@string/dashboard" />


        instead of



        <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"></LinearLayout>


        and add this in your activity



        Toolbar toolbar = findViewById(R.id.toolbar);

        if (getSupportActionBar()!=null){
        setSupportActionBar(toolbar);
        }


        also, add these to your theme



         <style name=" Your Style">
        <item name="android:windowActionBar">false</item>
        <item name="android:windowNoTitle">true</item>
        </style>





        share|improve this answer













        please add



        <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?android:attr/actionBarSize"
        android:background="@color/colorPrimary"
        android:minHeight="?android:attr/actionBarSize"
        android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
        app:title="@string/dashboard" />


        instead of



        <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"></LinearLayout>


        and add this in your activity



        Toolbar toolbar = findViewById(R.id.toolbar);

        if (getSupportActionBar()!=null){
        setSupportActionBar(toolbar);
        }


        also, add these to your theme



         <style name=" Your Style">
        <item name="android:windowActionBar">false</item>
        <item name="android:windowNoTitle">true</item>
        </style>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 16 '18 at 9:32









        BasiBasi

        633517




        633517













        • it worked thank you so much

          – vst dell
          Nov 16 '18 at 9:39











        • but the tool bar is not showing up i need to manually click and drag the drawer why is that?

          – vst dell
          Nov 16 '18 at 9:47











        • @vstdell please go through this tutorials

          – Basi
          Nov 16 '18 at 10:29



















        • it worked thank you so much

          – vst dell
          Nov 16 '18 at 9:39











        • but the tool bar is not showing up i need to manually click and drag the drawer why is that?

          – vst dell
          Nov 16 '18 at 9:47











        • @vstdell please go through this tutorials

          – Basi
          Nov 16 '18 at 10:29

















        it worked thank you so much

        – vst dell
        Nov 16 '18 at 9:39





        it worked thank you so much

        – vst dell
        Nov 16 '18 at 9:39













        but the tool bar is not showing up i need to manually click and drag the drawer why is that?

        – vst dell
        Nov 16 '18 at 9:47





        but the tool bar is not showing up i need to manually click and drag the drawer why is that?

        – vst dell
        Nov 16 '18 at 9:47













        @vstdell please go through this tutorials

        – Basi
        Nov 16 '18 at 10:29





        @vstdell please go through this tutorials

        – Basi
        Nov 16 '18 at 10:29













        0














        Try this code..
        add style into style.xml



            <style name="NoActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="android:windowActionBar">false</item>
        <item name="android:windowNoTitle">true</item>
        </style>


        pass in android manifest into activity..



                <activity android:name=".MainActivity"
        android:theme="@style/NoActionBar">





        share|improve this answer




























          0














          Try this code..
          add style into style.xml



              <style name="NoActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
          <item name="android:windowActionBar">false</item>
          <item name="android:windowNoTitle">true</item>
          </style>


          pass in android manifest into activity..



                  <activity android:name=".MainActivity"
          android:theme="@style/NoActionBar">





          share|improve this answer


























            0












            0








            0







            Try this code..
            add style into style.xml



                <style name="NoActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
            <item name="android:windowActionBar">false</item>
            <item name="android:windowNoTitle">true</item>
            </style>


            pass in android manifest into activity..



                    <activity android:name=".MainActivity"
            android:theme="@style/NoActionBar">





            share|improve this answer













            Try this code..
            add style into style.xml



                <style name="NoActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
            <item name="android:windowActionBar">false</item>
            <item name="android:windowNoTitle">true</item>
            </style>


            pass in android manifest into activity..



                    <activity android:name=".MainActivity"
            android:theme="@style/NoActionBar">






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 16 '18 at 9:31









            Android TeamAndroid Team

            8,01011437




            8,01011437























                0














                In your styles.xml use



                <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
                <!-- Customize your theme here. -->
                </style>



                Or provide a toolbar in layout and setSupportActionBar from activity if you want use



                Theme.AppCompat.Light.NoActionBar






                share|improve this answer




























                  0














                  In your styles.xml use



                  <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
                  <!-- Customize your theme here. -->
                  </style>



                  Or provide a toolbar in layout and setSupportActionBar from activity if you want use



                  Theme.AppCompat.Light.NoActionBar






                  share|improve this answer


























                    0












                    0








                    0







                    In your styles.xml use



                    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
                    <!-- Customize your theme here. -->
                    </style>



                    Or provide a toolbar in layout and setSupportActionBar from activity if you want use



                    Theme.AppCompat.Light.NoActionBar






                    share|improve this answer













                    In your styles.xml use



                    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
                    <!-- Customize your theme here. -->
                    </style>



                    Or provide a toolbar in layout and setSupportActionBar from activity if you want use



                    Theme.AppCompat.Light.NoActionBar







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 16 '18 at 9:34









                    webiankswebianks

                    8625




                    8625























                        0














                        I think you are missing toolbar in your xml. And you are also missing to set the toolbar in your code..



                        Toolbar toolbar = findViewById(R.id.toolbar);
                        setSupportActionBar(toolbar);




                        <android.support.v7.widget.Toolbar
                        android:id="@+id/toolbar"
                        android:layout_width="match_parent"
                        android:layout_height="?android:attr/actionBarSize"
                        android:background="@color/colorPrimary"
                        android:minHeight="?android:attr/actionBarSize"
                        android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
                        local:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                        local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
                        local:title="@string/dashboard" />





                        share|improve this answer






























                          0














                          I think you are missing toolbar in your xml. And you are also missing to set the toolbar in your code..



                          Toolbar toolbar = findViewById(R.id.toolbar);
                          setSupportActionBar(toolbar);




                          <android.support.v7.widget.Toolbar
                          android:id="@+id/toolbar"
                          android:layout_width="match_parent"
                          android:layout_height="?android:attr/actionBarSize"
                          android:background="@color/colorPrimary"
                          android:minHeight="?android:attr/actionBarSize"
                          android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
                          local:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                          local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
                          local:title="@string/dashboard" />





                          share|improve this answer




























                            0












                            0








                            0







                            I think you are missing toolbar in your xml. And you are also missing to set the toolbar in your code..



                            Toolbar toolbar = findViewById(R.id.toolbar);
                            setSupportActionBar(toolbar);




                            <android.support.v7.widget.Toolbar
                            android:id="@+id/toolbar"
                            android:layout_width="match_parent"
                            android:layout_height="?android:attr/actionBarSize"
                            android:background="@color/colorPrimary"
                            android:minHeight="?android:attr/actionBarSize"
                            android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
                            local:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                            local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
                            local:title="@string/dashboard" />





                            share|improve this answer















                            I think you are missing toolbar in your xml. And you are also missing to set the toolbar in your code..



                            Toolbar toolbar = findViewById(R.id.toolbar);
                            setSupportActionBar(toolbar);




                            <android.support.v7.widget.Toolbar
                            android:id="@+id/toolbar"
                            android:layout_width="match_parent"
                            android:layout_height="?android:attr/actionBarSize"
                            android:background="@color/colorPrimary"
                            android:minHeight="?android:attr/actionBarSize"
                            android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
                            local:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                            local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
                            local:title="@string/dashboard" />






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Nov 16 '18 at 9:42









                            cricket_007

                            83.9k1147118




                            83.9k1147118










                            answered Nov 16 '18 at 9:29









                            Amit JangidAmit Jangid

                            1,2731917




                            1,2731917















                                Popular posts from this blog

                                Florida Star v. B. J. F.

                                Danny Elfman

                                Lugert, Oklahoma