当我单击项目时没有任何反应,我尝试更改颜色、显示所选元素的数量、显示日志什么也没有发生
我的ViewHolder
class MyViewHolder(view: View) : RecyclerView.ViewHolder(view) {
val name: TextView = view.list_item_name
val phone: TextView = view.list_item_phone
// More code here
fun getItemDetails(): ItemDetailsLookup.ItemDetails<Long> =
object : ItemDetailsLookup.ItemDetails<Long>() {
override fun getSelectionKey(): Long? = itemId
override fun getPosition(): Int = adapterPosition
}
}
Run Code Online (Sandbox Code Playgroud)
我的物品详情查找
class MuLookup(private val rv: RecyclerView) : ItemDetailsLookup<Long>() {
override fun getItemDetails(event: MotionEvent): ItemDetails<Long>? {
val view = rv.findChildViewUnder(event.x, event.y)
if (view != null) {
return (rv.getChildViewHolder(view) as MyViewHolder)
.getItemDetails()
}
return null
}
}
Run Code Online (Sandbox Code Playgroud)
我的适配器 …
由于 mysql 5.7.5 group by 有变化
https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html
如果我做这个查询
$qb = $this->createQueryBuilder('d');
$qb->select('ANY_VALUE(d.id), d.nom, count(d.nom) as lignes');
$qb->groupBy('d.nom');
$qb->orderBy('d.nom');
Run Code Online (Sandbox Code Playgroud)
我有一个错误
SELECT列表的表达式 #1不在GROUP BY子句中,并且包含非聚合列“ sepultures.d0_.id”,该列在功能上不依赖于 GROUP BY 子句中的列;这与 sql_mode=only_full_group_by 不兼容
正如mysql doc中的解释,这个问题可以用这样的any_value解决
$qb = $this->createQueryBuilder('d');
$qb->select('ANY_VALUE(d.id), d.nom, count(d.nom) as lignes');
$qb->groupBy('d.nom');
$qb->orderBy('d.nom');
Run Code Online (Sandbox Code Playgroud)
但是学说不承认这个功能
[2/2] QueryException: [Syntax Error] line 0, col 7: Error: 预期已知函数,得到“ANY_VALUE”
我该如何解决?
我正在尝试从图库中发送照片,但出现错误指示找不到图像
请求甚至不去服务器
在片段中
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode == Activity.RESULT_OK) {
when (requestCode) {
REQUEST_SELECT_IMAGE_IN_ALBUM -> {
val contentURI = data!!.data
postServer(contentURI)
}
}
}
}
private fun postServer(contentURI: Uri) {
val MEDIA_TYPE_IMAGE: MediaType = MediaType.parse("image/*")!!
val file = File(contentURI.path)
val requestBody: RequestBody = RequestBody.create(MEDIA_TYPE_IMAGE, file)
mercrediViewModel.uploadImage(enfant, requestBody)
}
Run Code Online (Sandbox Code Playgroud)
在我的模型中
fun uploadImage(enfant: Enfant, requestBody: RequestBody) {
viewModelScope.launch {
val request = mercrediService.uploadImage("****", enfant.id, requestBody)
request.enqueue(object : Callback<ResponseBody> {
override fun onFailure(call: …Run Code Online (Sandbox Code Playgroud)