I\'m new in Android programming. I\'m having this issue when I applied the toolbar into my app and it crashed when I try to run the app. Here is the code:
To
You can see in your logcat output the answer:
Do not request Window.FEATURE_ACTION_BAR, set windowActionBar to false in your theme to use a Toolbar instead.
Also try using this link and this link
make sure you use this:
<item name="windowActionBar">false</item>
in your theme
Try this fix, it worked for me:
Link to the StackOverFlow answer
Also check for the below link for using AppCompat:
Reference link for the AppCompat library
If you use Toolbar
from v7-support, you should use Theme.AppCombat
in your Activity
.
Define your style in styles.xml
<style name="AppTheme" parent="Theme.AppCompat">
<item name="colorPrimary">@color/black</item>
</style>
<color name="black">#000000</color>
And apply it to whole application (or specyfic Activity
) in AndroidManifest.xml
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >