In Android Studio I have a Kotlin project with a button that sends an SMS message. When the Send SMS permission for the app is denied, the button is disabled. When a user clicks the disabled button, I would like to display a toast message to the user:
Toast.makeText(this, R.string.smsDisabled, Toast.LENGTH_LONG).show()
However, after much research I haven't been able to make this disabled button clickable. I have tried things like smsButton.isClickable = true
on the button, but it still doesn't work. If it is possible to style the button to simply look like it is disabled, that would work too. My button style is currently set to @style/Widget.MaterialComponents.Button
and I haven't had any success in changing the button colors. I have tried applying a background, backgroundTint, custom theme, and creating a custom background like in this question.
I am new to Android Studio so I have limited knowledge and experience. Is there a way to achieve this functionality?