该功能仅第二次起作用

时间:2019-02-24 09:53:54

标签: android kotlin android-room anko

我长按了一下任务,然后它消失了,我转到另一个屏幕并返回查看此任务,之后再次长按它,直到任务完成(状态= 1), 调试器说代码已执行

override fun onLongClick(view: View, position: Int) {
    val aims = aimsList!![position]
    aimsList!!.removeAt(position)
    adapter!!.notifyItemRemoved(position)
    doAsync {
        aims.state = 1 //state "1" is completed task, state"0" is uncompleted 
        AimsDataBase.getINSTANCE(context!!).daoAccess().updateAim(aims)`

        uiThread {
            Toast.makeText(context!!, "completed", Toast.LENGTH_SHORT).show()
        }
    }
}

0 个答案:

没有答案