Android Question label invisible and desabled but still cliquable !!!

bijou

Member
Licensed User
Hi
I have a problem: i try to make an app that asks questions to user with check button after that a label is enabled and made visible according to the answer, and also a button that refresh the activity to try again when answer is false, but then even before answering if you clique on the blank place where label will appear the next activity will be executed !!! what should i do to enable the code only after answering the question actually i am just playing with
B4X:
Label2.Enabled=False
Label2.Visible=False
'and
Label2.Enabled=True
Label2.Visible=True

'and to reload the activity
Sub ImageView8_Click
    StartActivity("Page1")
    Activity_Create(True)   
End Sub
according to the situation !
 
Last edited:

bijou

Member
Licensed User
Yes you're totally right ! because when i reload the page it doesn't really refresh the content totally, so now i add this code and it looks correct i think:
B4X:
' i add this line
Activity.RemoveAllViews

'and then
StartActivity("Page1")
Activity_Create(True)
 
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
are you using msgbox?clicking outside the msgbox will load the actvity

set label.enabled = false so that even u click on the black space the label is not clickable
 
Upvote 0

bijou

Member
Licensed User
Hi, here is the code:
B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("L_Page2")
    ImageView1.Visible=True
    ImageView5.Visible=False
       ImageView4.Visible=True
    ImageView8.Enabled=False
    ImageView8.Visible=False

Sub Label3_Click
    Activity.RemoveAllViews
    StartActivity("Page3")
    Activity_Create(True)
End Sub
Sub Label2_Click
    Activity.RemoveAllViews
    StartActivity("Page3")
    Activity_Create(True)
End Sub
Sub ImageView4_Click
    Activity.RemoveAllViews
    StartActivity("Main")
    Activity_Create(True)
End Sub
Sub ImageView5_Click
    Activity.RemoveAllViews
    StartActivity("Main")
    Activity_Create(True)
End Sub
Sub ImageView6_Click
    Label4.Visible=True
    Timer1.Initialize("Timer1", 3600)
    Timer1.Enabled=True
   
End Sub

Sub Timer1_tick
Label4.Visible=False
Timer1.Enabled = False
End Sub
Sub ImageView7_Click
    Label4.Visible=True
    Timer1.Initialize("Timer1", 3600)
    Timer1.Enabled=True
   
End Sub
Sub ImageView8_Click
    Activity.RemoveAllViews
    StartActivity("Page2")
    Activity_Create(True)
   
End Sub

Sub ImageView2_Click
   EditText1.Enabled=False
   ImageView2.Visible=False
   If EditText1.Text="Ajeggagay" Then
   Label2.Visible=True
Else
   Label3.Visible=True
   ImageView1.Visible=False
   ImageView3.Visible=True
   ImageView5.Visible=True
   ImageView4.Visible=False
   ImageView6.Visible=False
   ImageView7.Visible=True
   ImageView8.Enabled=True
   ImageView8.Visible=True
 
End If
End Sub

As i mentioned it above, when i add this line it seems to work ok, when views are removed and activity is refreshed is not fast so i see a dark screen and new activity come above the first one but it's ok:

B4X:
Activity.RemoveAllViews
 
Upvote 0
Top