NPE while inflating layout (Attempt to invoke virtual method ‘boolean java.lang.String.equals(java.lang.Object)’ on a null object reference)

Change <view to <View, because view is not about empty view. It’s for custom view defined through class attr, like below: <view android:layout_width=”wrap_content” android:layout_height=”wrap_content” class=”com.your.package.YourCustomView” /> And you got Caused by: java.lang.NullPointerException: Attempt to invoke virtual method ‘boolean java.lang.String.equals(java.lang.Object)’ on a null object reference because of LayoutInflater tries to parse class attr: LayoutInflater source code … Read more

How to change the background color of the options menu?

After spending a considerable amount of time trying all the options, the only way I was able to get an app using AppCompat v7 to change the overflow menu background was using the itemBackground attribute: <style name=”AppTheme” parent=”Theme.AppCompat.Light.DarkActionBar”> … <item name=”android:itemBackground”>@color/overflow_background</item> … </style> Tested from API 4.2 to 5.0.