【问题标题】:java.lang.RuntimeException: Found conflicting getters for name getOverlay on class android.widget.DatePickerjava.lang.RuntimeException:在类 android.widget.DatePicker 上发现名称 getOverlay 的 getter 冲突
【发布时间】:2021-03-29 21:24:02
【问题描述】:

有人可以帮我解决这个错误吗?我正在尝试从 DatePicker 组件中获取生日日期,并将其保存在 Firebase Firestore 中,但出现此错误:

java.lang.RuntimeException:在类 android.widget.DatePicker 上发现名称 getOverlay 的 getter 冲突

DatePicker 组件是名为 dtNascimento 和 etDtNascimento 的变量

private fun createNewAccount() {
    nome = etNome!!.getText().toString()
    cpf = etCpf!!.getText().toString()
    dtNascimento = etDtNascimento


    if (TextUtils.isEmpty(nome) || TextUtils.isEmpty(cpf)){
        Toast.makeText(this, "Entre com mais detalhes!", Toast.LENGTH_SHORT).show()
    }else{

        val user = hashMapOf<String, Any?>(
                "nome" to nome,
                "cpf" to cpf,
                "dtNascimento" to dtNascimento
        )

        db.collection("pessoas")
                .add(user)
                .addOnSuccessListener {documentReference->
                    Log.d(tag, "DocumentSnapshot added with ID: ${documentReference.id}\"")
                }
                .addOnFailureListener{e->
                    Log.w(tag, "Error adding document", e)
                }

        Toast.makeText(this, "Informações preenchidas com sucesso!", Toast.LENGTH_SHORT).show()
        updateUserInfoAndUI()
    }

}

【问题讨论】:

  • 对不起,弗兰克,我忙于编码,忘记就您的回答提供反馈。是的,它帮助了我,非常感谢!

标签: android firebase kotlin google-cloud-firestore


【解决方案1】:

您似乎正在尝试使用 dtNascimento = etDtNascimento 将日期时间picker 视图写入数据库,这是不受支持的。

您可能想写出实际选择的日期/时间。

另见:

【讨论】:

    猜你喜欢
    • 2020-07-10
    • 2018-08-24
    • 2019-07-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-18
    相关资源
    最近更新 更多