Trying to move over my stuff to use Toolbar
instead of action bar but I keep getting an error saying
java.lang.RuntimeException: Unable to start
Simply put, you can do the following:-
if (android.os.Build.VERSION.SDK_INT >= 21) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setStatusBarColor(getResources().getColor(R.color.colorPrimaryDark));
}
I had toolbar added in my xml. Then in my activity i was adding this statement:
setSupportActionBar(toolbar);
Removing this worked for me. I hope it helps someone.
Add this two line in your app theme located in style.xml:-
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
//Add this two line will fix your problem
<item name="windowNoTitle">true</item> <--1(this applies after 22.0.1 support library i think
<item name="windowActionBar">true</item> <--2
Use this inside your application tag in manifest or inside your Activity tag.
android:theme="@style/AppTheme.NoActionBar"
Or Simply change the @Style/AppTheme
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
This works for me!
Go to the 'style.xml' of your project and make windowActionBar to false
<style name="AppCompatTheme" parent="@style/Theme.AppCompat.Light">
<item name="android:windowActionBar">false</item>
</style>