BoD/android-switch-backport

Getting Null pointer exception

PreetiW opened this issue · 4 comments

Failed to find style 'asb_switchStyle' in current theme
java.lang.NullPointerException
Exception details are logged in Window > Show View > Error Log

java.lang.NullPointerException
at android.text.Layout.getDesiredWidth(Layout.java:68)
at org.jraf.android.backport.switchwidget.Switch.makeLayout(Switch.java:350)
at org.jraf.android.backport.switchwidget.Switch.onMeasure(Switch.java:302)
at android.view.View.measure(View.java:17430)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:727)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:463)
at android.view.View.measure(View.java:17430)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:727)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:463)
at android.view.View.measure(View.java:17430)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
at android.view.View.measure(View.java:17430)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:875)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
at android.view.View.measure(View.java:17430)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:875)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
at android.view.View.measure(View.java:17430)

I added the style as described as follows :

<style name="AppTheme" parent="@android:style/Theme"> true false false @null @style/Widget.Holo.CompoundButton.Switch </style>

stil i ma getting the error . I am assuming i am not describing the style properly can you please help.

BoD commented

You defined the style, but are you actually using the theme?

I didnt get you.. can you elaborate please?

BoD commented

You have defined a theme with the above attributes.
But you also have to use the theme in your application or activity - did you do it?

yes i've defined the above in my manifest file