如何解决AndroidX Preference聆听长按
我有使用AndroidX首选项库构建的应用程序设置。我正在尝试根据喜好捕获长按事件,但不确定是否可能并且未成功。以下是用于捕获@Query("""Select * from sites
inner join groups on groups.site_id = :siteId
where site_id = :siteId and groups.group_id = :groupId
""")
fun getByIdWithGroup(siteId: Int,groupId: Int): LiveData<SiteGroup>
的点击的设置。我还可以添加长按监听器吗?
error: There is a problem with the query: [sqlITE_ERROR] sql error or missing database (ambiguous column name: site_id)
public abstract androidx.lifecycle.LiveData<com.example.model.entities.pojos.SiteGroup> getByIdWithGroups(int siteId,int groupId)
Incremental annotation processing requested,but support is disabled because the following processors are not incremental: androidx.room.RoomProcessor (DYNAMIC).
setonPreferenceClickListener()
build.gradle (Module: app)
...
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.preference:preference:1.1.1'
...
MainActivity.kt
class MainActivity : AppCompatActivity() {
private lateinit var settingsButton: ImageButton
override fun onCreate(savedInstanceState: Bundle?) {
...
settingsButton = findViewById(R.id.settingsButtonMain)
settingsButton.setonClickListener {
settingsClicked()
}
...
}
private fun settingsClicked() {
val settingsIntent = Intent(this,SettingsActivity::class.java)
startActivity(settingsIntent)
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。