When I added Text Input layout to my xml file its working but when i click on date picker class app is crashing

2570 views android
2

Hi am making my edittext to matDesign(TextInput layout).it is working fine .But when i click on date picker the app is crashing says,

My gradle file as below apply plugin: 'com.android.application' Attempt to invoke virtual method 'int android.widget.NumberPicker.getChildCount()' on a null object reference Attempt to invoke virtual method 'int android.widget.NumberPicker.getChildCount()' on a null object reference

enter code here

Not Understanding,By removing Text input layout works fine.. I have defined Theme.AppCompat.Light in manifest

answered question

Sorry forgot to add , compileSdkVersion 25 buildToolsVersion '28.0.3,,minSdkVersion 18 targetSdkVersion 25' and 25 App compat Library

1 Answer

3

Your NumberPicker is null, It is either not initialized or If you have used findViewById, It has not been found, therefore, calling getChildCount on a null object will throw NullPointerException.

Try to resolve the NumberPicker reference and make sure that it is not null and found in your View/Activity/Fragment.

posted this

Have an answer?

JD

Please login first before posting an answer.