Button not working- Issue

sarim123

Member
Licensed User
Longtime User
I have been trying to fix this issue for hours now and i cant seem to tell what i am doing wrong. My button will not work for some reason. I cant find what i am doing wrong. There is no error. The button just does not change the activity modules.
Here is the code and project

B4X:
'Activity module
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.
End Sub

Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.
   Dim AnimPlus As AnimationPlus
   Dim ivAndroid As ImageView
   Dim ivAndroid2 As ImageView
   Dim ivAndroid3 As Button

   Dim ButtonPlay As Button
   Dim ButtonSettings As Button
   Dim ButtonCredits As Button

   Dim A2, A3, A4 As AnimationPlus
   Dim AnimSet As AnimationSet
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.Color = Colors.White
   
   
   ivAndroid.Initialize("")
   ivAndroid.SetBackgroundImage(LoadBitmap(File.DirAssets, "Talking Tina Words.png"))
   Activity.AddView(ivAndroid, -235dip, -125dip, 850dip, 400dip)
   
   'Left Top Width Height
   ivAndroid2.Initialize("")
   ivAndroid2.SetBackgroundImage(LoadBitmap(File.DirAssets, "Hello.png"))
   Activity.AddView(ivAndroid2, 115dip, -100dip, 350dip, 800dip)
   
   ButtonPlay.Initialize ("")
   ButtonPlay.SetBackgroundImage(LoadBitmap(File.DirAssets, "bubbleplay.png"))
   Activity.AddView(ButtonPlay, 210dip, 80dip, 150dip, 150dip)
   ButtonPlay.Visible = True
   
   
   A2.InitializeScaleCenter("Anim2", 0.01, 0.01, 0.5, 0.5, ivAndroid2)
   A2.RepeatCount = 0
   A2.RepeatMode = 1

   A3.InitializeScaleCenter("Anim3", 0.1, 0.1, 0.5, 0.5, ivAndroid)
   A3.RepeatCount = 0
   A3.RepeatMode = 1

   AnimSet.Initialize(False)
   AnimSet.AddAnimation(A3)
   AnimSet.Duration = 1500
   AnimSet.PersistAfter = True
   AnimSet.Start(ivAndroid)
   
   AnimSet.Initialize(False)
   AnimSet.AddAnimation(A2)
   AnimSet.Duration = 1500
   AnimSet.PersistAfter = True
   AnimSet.Start(ivAndroid2)
End Sub


Sub Activity_Resume
   
End Sub

Sub Activity_Pause(UserClosed As Boolean)
End Sub

Sub ButtonPlay_Click
   StartActivity("Start")

End Sub


Here is the project

https://www.dropbox.com/s/iybj6temiq7udpj/sarimappissue1.zip

Thanks for your support.
 

sorex

Expert
Licensed User
Longtime User
Sarim: why don't you use the designer? 80+% of your project can be done in the designer by just clicking around. (right clicking you button gives you options to create that click event automatically)
 
Upvote 0

sarim123

Member
Licensed User
Longtime User
Thanks so much agraham!!!!!
Ya sorex. I'm using the designer for the rest of my app it's just the begining part that is all code.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…