Android Question Button1.enabled = true error

Douglas Farias

Expert
Licensed User
Longtime User
i m want to simple enable my button and i have this error

my button is made on design

my layout is initializated normal
no problems

on design my button is enabled = false

i m trying this to enable
B4X:
If kv.ContainsKey("Dica1-"&estado&cidade&eventoatual) = True Then
Button1.Enabled = True
End If

but give a error
android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.


 

Attachments

  • Sem título.png
    217.8 KB · Views: 182

stevel05

Expert
Licensed User
Longtime User
It looks like you are running in a thread, you can't touch the views directly. You need to set up a subroutine to do the work then call that with the threads RunOnGuiThread method.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…