Android Code Snippet Checkbox as an Indicator and SetClickable

Subname: None

Description: The android.view.View class has a method setClickable which determines whether or not the view responds to being clicked. The android.view.View class is the parent of most (if not all) of the UI objects we use, it's methods are inherited by it's children which means we can use it's methods on most of our UI objects.

Using this method via JavaObject, we can set a Checkbox (and other views) so that it does not respond to clicks, and therefore behaves as an indicator. It can still be changed via code.

Code: Copy
Dim cbJO As JavaObject = Checkbox1
cbJO.RunMethod("setClickable",Array As Object(False))

Sets Checkbox1 as non-clickable.

Depends on: JavaObject

Tags: Checkbox, View, Clickable
 
Last edited:
Isn't it the same as:

Check.Initialize("")
and
Check.Enabled = false
 
Not quite, enabled = false will show the disabled image from the views state list drawable if it has one.
 
Last edited:
Back
Top