Null pointer exception on switch widget in kitkat version
<p>I have used switch widget in my application. when I run app on lollipop, its working fine with it. but when I run in kitkat version, its going to crash. </p>

<p>xml design:</p>

<pre><code> &lt;Switch
                android:id="@+id/act_edit_device_swtch"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:switchMinWidth="40sp"
                android:thumb="@null"
                android:track="@drawable/switchdb" /&gt;
</code></pre>

<p>switchdb.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;

    &lt;item android:drawable="@drawable/onswitch" android:state_checked="true"/&gt;
    &lt;item android:drawable="@drawable/offswitch" android:state_checked="false"/&gt;
    &lt;item android:drawable="@drawable/offswitch"&gt;&lt;/item&gt;

&lt;/selector&gt;
</code></pre>

<p>below is my crash report:</p>

<pre><code>java.lang.NullPointerException
       at android.widget.Switch.jumpDrawablesToCurrentState(Switch.java:825)
       at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5500)
       at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5500)
       at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5500)
       at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5500)
       at android.widget.FrameLayout.jumpDrawablesToCurrentState(FrameLayout.java:189)
      at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5500)
       at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5500)
       at android.widget.FrameLayout.jumpDrawablesToCurrentState(FrameLayout.java:189)
       at android.view.View.onAttachedToWindow(View.java:12146)
       at android.view.ViewGroup.onAttachedToWindow(ViewGroup.java:3499)
       at com.android.internal.policy.impl.PhoneWindow$DecorView.onAttachedToWindow(PhoneWindow.java:2659)
       at android.view.View.dispatchAttachedToWindow(View.java:12620)
       at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2460)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1236)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1019)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5725)
</code></pre>