When I compile Code A, I get an error, the system prompt me exists a method name setEditText
.
But fun setIsShowEditDialog(isShow:Boolean)
is OK without prompt exists a method name setIsShowEditDialog
, why?
I have to change fun setEditText(input:String)
to fun set_EditText(input:String)
, it's OK to compile.
But Android Studio prompt me a warning information: Function name 'set_EditText' should not contain underscores , why ?
Code A
class EditDialogState private constructor(context: Context) {
var isShowEditDialog by mutableStateOf(false)
private set
var editText by mutableStateOf("")
private set
fun setIsShowEditDialog(isShow:Boolean) { //It's OK
isShowEditDialog = isShow
}
fun setEditText(input:String) { //Compile Error
editText = input
}
}