【发布时间】:2019-11-02 09:03:04
【问题描述】:
class ScheduleUpdateDialog(private val schedules: ArrayList<Schedule>)
: DialogFragment() {
...
inner class DialogListener : DialogInterface.OnClickListener {
override fun onClick(dialog: DialogInterface?, which: Int) {
when(which) {
DialogInterface.BUTTON_POSITIVE -> {
val content = calendarScheduleText.text.toString()
if(content != "") {
db.collection("schedules").document(id!!)
.update("content", content)
schedule.content = content
mainActivity.onDialogClick()
}
}
DialogInterface.BUTTON_NEUTRAL -> {
db.collection("schedules").document(id!!)
.delete()
schedules.removeAt(index!!)
mainActivity.onDialogClick()
}
}
}
}
}
【问题讨论】:
-
您可以从
ArrayList中删除元素。为什么你认为你不能? -
如果遇到错误可以分享一下吗