val receiptDetails = headerView.findViewById(R.id.tb_receipt_details) as TextView
val paymentDetails = headerView.findViewById(R.id.tb_payment_details) as TextView
val invoiceDetails = headerView.findViewById(R.id.tb_invoice_details) as TextView
val summary = headerView.findViewById(R.id.tb_summary) as TextView
tabLayout!!.getTabAt(0)!!.setCustomView(receiptDetails)
tabLayout!!.getTabAt(1)!!.setCustomView(paymentDetails)
tabLayout!!.getTabAt(2)!!.setCustomView(invoiceDetails)
tabLayout!!.getTabAt(3)!!.setCustomView(summary)
tabLayout!!.getChildAt(1).setEnabled(false)
Здесь я получил исключение нулевого указателя, когда я вызвал tabLayout !!. GetChildAt (1) .setEnabled (false) .Как я могу отключить конкретную вкладку в Kotlin.Заранее спасибо.
logcat
12-03 10:03:27.536 7899-7899/com.salesrep.auxxa.alliontechnologies.auxxasr E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.salesrep.auxxa.alliontechnologies.auxxasr, PID: 7899
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.salesrep.auxxa.alliontechnologies.auxxasr/com.salesrep.auxxa.alliontechnologies.auxxasr.NewPaymentActivity}: kotlin.KotlinNullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: kotlin.KotlinNullPointerException
at com.salesrep.auxxa.alliontechnologies.auxxasr.NewPaymentActivity.onCreate(NewPaymentActivity.kt:84)
at android.app.Activity.performCreate(Activity.java:5937)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)