Android Question How to caught Speak1.TargetEditText ?

Theera

Well-Known Member
Licensed User
Longtime User
Hi all,
Refer to this, If I add the view Toggle for display state of ON/OFF,How do I code ?

I have code as below,but it's not right.

B4X:
  ...
  Speak1.TargetEditText=EditText1  'Assume User spoke "ON"

  if  EditText1.Text="ON" then
      Tb1.checked=True
  else if  EditText1.Text="OFF" then
      Tb1.checked=False
  End if
 

Theera

Well-Known Member
Licensed User
Longtime User
Hi Erel or others,
I've done finished as below
B4X:
Sub EditText1_TextChanged (Old As String, New As String)
   If Old <> New Then
       Dim sf As StringFunctions
      sf.Initialize
       tb.checked=sf.iif(tb.Checked=True,False,True)
   End If
  
End Sub

,but I'm coding about HouseAutmation for controling electric equipments. Assume I have 3 electric equipments as toggle views. How do I code by VoiceRecognition(Google Now) ?(How to check EditText1.text?)
 
Last edited:
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
Hi again. This is my code (from another one) . I need to learn using wifi module to control alike this.
 

Attachments

  • Test1.zip
    144.5 KB · Views: 117
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
What exactly do you want to do ?
What is the user supposed to speak to make a change ?
What is not working, do you get error messages, what is displayed in the EditText view ?
You must be much more precice in your questions.

For this
tb1.checked=sf.iif(tb1.checked=True,False,True)
you don't need StringFunctions, just use
tb1.checked = Not(tb1.checked)
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
Thank you Klaus and Erel. I've done. I must use sld1 for toggle view1,sld2for toggle view2,and sld3 for toggle view3 instead of sld for all.

P.S. I've still remember NjDude'Birthday 6 Dec,Klaus'Birthday 14 Dec. All of you are important to me.(I'm sorry many expert I don't know your birthdays)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
<- 19 Dec :)
 
Upvote 0
Top