Here is my code inside accessibility service
" if (isLongPressEnabled && event.eventType == AccessibilityEvent.TYPE_VIEW_LONG_CLICKED) {
event.source?.text?.let { text ->
highlightText(event.source!!)
speakWithRateLimit(text.toString())
}
}" and here is my button inside mainactivity " binding.mySwitchfb.setOnCheckedChangeListener { _, isChecked ->
saveSwitchState("switchfb", isChecked)
Log.d("SwitchState", "isEventEnabled: $isChecked")
}" want to on/off the event by button click. Suggest me with your tasted code.