When clicking on a switch in my app in Android 5.0 the app crashes with the logcat shown below. The logcat doesn\'t reference my code anywhere in it, and this switch has worked
I had the same problem. I solved it by changing:
android:thumb="@null"
to:
android:thumb="@drawable/transparent_thumb"
android:track="@drawable/transparent_track"
transparent_thumb & transparent_track are two png files which are transparent. They have matched size to your customized Switch.
I faced with the same issue at Sony tablet with Android 5.0.2 - Switch crash my app when activity style is NoTitleBar / FullScreen.
What worked well for me, is to set FullScreen mode in code and not inside manifest.
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
If I don't mess something up, the results is the same as usuall, but without crash.
It seems like a known issue in Android 5.
Please refer the following link :
https://code.google.com/p/android-developer-preview/issues/detail?id=1704
Just change thumb and track images for the switch.
Changing the theme in manifest file worked for me. i had android:theme="@android:style/Theme.NoTitleBar"
and changed it into
android:theme="@android:style/Theme.DeviceDefault"