Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two Spinner on a form #8

Open
keldorn83 opened this issue Apr 27, 2020 · 0 comments
Open

Two Spinner on a form #8

keldorn83 opened this issue Apr 27, 2020 · 0 comments

Comments

@keldorn83
Copy link

Hello i have a problem when i use two spinner on a form.

My model :

class AnomalyData {

    @Form(type = Form.SPINNER, position = 1)
    private val origine: String? = null

    @Form(type = Form.SPINNER, position = 2)
    private val emplacement: String? = null

    @Form(type = Form.IMAGE, position = 3)
    private val photo: String? = null

    @Form(position = 4)
    private val commentaire: String? = null

    companion object {
        var FIELD_ORIGIN = "origine"
        var FIELD_CATEGORY = "emplacement"

My Activity :

private fun setUpForm() {
        form.setModels(AnomalyData())
        form.fillData(AnomalyData.FIELD_ORIGIN, AnomalyData.initOrigin())
        form.fillData(AnomalyData.FIELD_CATEGORY, AnomalyData.initSubSecurityOrigin())

        form.addListener(AnomalyData.FIELD_ORIGIN) { value, adapter ->
            when (value) {
                AnomalyData.ORIGIN_SECURITY -> {
                    adapter.updateData(
                            AnomalyData.FIELD_CATEGORY, AnomalyData.initSubSecurityOrigin())
                }
                AnomalyData.ORIGIN_BODY -> {
                    adapter.updateData(
                            AnomalyData.FIELD_CATEGORY, AnomalyData.initSubBodyOrigin())
                }
                AnomalyData.ORIGIN_CLEANLINESS -> {
                    adapter.updateData(
                            AnomalyData.FIELD_CATEGORY, AnomalyData.initSubCleanlinessOrigin())
                }
                AnomalyData.ORIGIN_ADMINISTRATIVE -> {
                    adapter.updateData(
                            AnomalyData.FIELD_CATEGORY, AnomalyData.initSubAdministrativeOrigin())
                }
                else -> {
                    adapter.updateData(
                            AnomalyData.FIELD_CATEGORY, AnomalyData.initSubEventsToReportOrigin())
                }
            }
        }

        form.buildForm()
    }

I have this error :

java.lang.NullPointerException: Attempt to invoke interface method 'void com.github.arisan.ArisanListener$OnCondition.onValue(java.lang.String, com.github.arisan.adapter.FormAdapter)' on a null object reference

When i use CheckBox instead of Spinner for the second element in my Model, i don't have any problem.

Can you help me please ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant