Description
This is the sixth lab and now we introduce a new program that we will be using for projects and its appventor, unlike python where you type and try to solve the codes in various sections, in appventor there is something calle event handlers that you choose to command for their behaviors to perform. This lab features a whole new concept in where we have to use commands like text, button, and sound and also vibration to find the solution of a cat trying to come out with a sound of meow, first we have to find for the a cat to say meow. We will be using picture of a cat, the sound of view and understanding of appventor to complete the lab
Code
This is the code i used to solve the cat purr lab in appventor website basically ill be breaking down the functions of all event handlers here first we always have to start with the button function in the palette because thats how we first function the program. Next we use the sound.play function, this function tells us to bring out a sound from something and of course this sound is the cat making the meow sound Together with the button and sound.play blocks we could make it function. But we will need to add the sound.vibrate to make the block not do anything that its not supposed to do so with this addition now the block can function. The next block is the primary objective to this lab which is adding the accelerometersensor which it will make this program function only if you shake the phone to make the cat to make a sound and by adding the sound block inside to the shaking sensor block the cat will make a sound by shaking the android device.
main=appinventor.ai_pineroskevin.hello.Screen1 name=hello assets=../assets source=../src build=../build versioncode=1 versionname=1.0 useslocation=False
#| $JSON {"YaVersion":"75","Source":"Form","Properties":{"$Name":"Screen1","$Type":"Form","$Version":"10","Uuid":"0","Title":"Screen1","$Components":[{"$Name":"Button1","$Type":"Button","$Version":"5","Uuid":"-1808931261","Visible":"False"},{"$Name":"Image1","$Type":"Image","$Version":"1","Uuid":"776572569","Picture":"kitty.png"},{"$Name":"Label1","$Type":"Label","$Version":"2","Uuid":"-719792876","FontSize":"30","Text":"Pet the Kitty"},{"$Name":"Sound1","$Type":"Sound","$Version":"3","Uuid":"1436405485","Source":"meow.mp3"},{"$Name":"AccelerometerSensor1","$Type":"AccelerometerSensor","$Version":"2","Uuid":"167898625"}]}} |#
Screenshot
The following is the screenshot of both the screens i add to complete this lab hellopurr + vibrate the screenshot to the left is my screen that i used to layout my project for this lab as you see it has a cat photo plus a text button but you dont see it and also a label of pet the kitty which was required for this lab. And to the right is the screenshot of my work done in the blocks editor unlike in the screen in the left the one in the right shows the breakdown of the lab and how it functioned that way and thats the result of the lab. To the left is the screen and to the right is the block editor , the screen that was used to create the blocks to function this lab.