dkharrat / NexusDialog

Library that allows you to easily and quickly create forms in Android with little code
Apache License 2.0
183 stars 52 forks source link

Fragment Feature not function in tabbed application #40

Closed powellbird closed 7 years ago

powellbird commented 8 years ago

The feature FormFragment only works if you set it on the same page of the activity, when I use tabLayout and FragmentPagerAdapter tabbed this does not work because when changing TAB, and want to use the controls, causes a null value and the application stops function.

Example I have three fragments with different controls when changing tab and want to capture information in a text or change value in a picker marks the next error.

FATAL EXCEPTION: main Process: com.github.dkharrat.nexusdialog.sample, PID: 28643 java.lang.NullPointerException: Attempt to invoke virtual method 'void com.github.dkharrat.nexusdialog.FormElementController.refresh()' on a null object reference at com.github.dkharrat.nexusdialog.FormController$1.propertyChange(FormController.java:247) at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:396) at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:88) at com.github.dkharrat.nexusdialog.FormModel.setValue(FormModel.java:62) at com.github.dkharrat.nexusdialog.controllers.EditTextController$1.afterTextChanged(EditTextController.java:195) at android.widget.TextView.sendAfterTextChanged(TextView.java:8017) at android.widget.TextView$ChangeWatcher.afterTextChanged(TextView.java:10178) at android.text.SpannableStringBuilder.sendAfterTextChanged(SpannableStringBuilder.java:1043) at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:560) at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:492) at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:491) at android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:685) at android.view.inputmethod.BaseInputConnection.setComposingText(BaseInputConnection.java:445) at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:340) at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:78) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5443) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

powellbird commented 8 years ago

Thank you, would be very grateful if you help me implement correctly.

powellbird commented 8 years ago

This is the application with the errors sample-debug.zip