Instead of two buttons (Agree/Disagree), use a single List Picker with Elements 'Agree with speaker'/Disagree with Speaker'.
There is no other way to click both the button at multiple times while running the app because I want to add pictures in both the buttons?
It's not clear what you want your app to do.
Is it a quiz or a survey, where you have to mark each item (text or picture) in a list with Agree or Disagree?
In that case, reuse the buttons and set each button's attributes fresh for each new item on the list of questions, statements, or pictures.
(I am guessing it will be a list because I see a series of Labels in your code.)
I recommend reading chapters 8 and 19 in http://www.appinventor.org/book2
(from FAQ Section: Books, Tips, Tutorials for AI2)
No, it is not a quiz or a survey game, I am making a Drawing app in which if the user click on Agree_to_Speaker then the user is able to hear the sound and if the user click on Disagree_to_Speaker then the user is not able to hear the sound. And also I want that when the screen initialize, then Agree_to_Speaker is on by default.
Please anybody help me in this
We would help, but I don't think we understand what the problem is.
I thing... you just want to have keys that turn the sound on and off, and you should it be enabled by default?
You need to swap the blocks you have in both click events.
You also need to add a variable named "sound" for example and set it to false or true. Wherever you want to play the sound, you need to add conditions. If the variable "sound" is true then play the sound.
In initialize, one of the buttons must be disabled.
This is the code of the buttons, When the screen initializes of the app on phone, then I am only able to click either Agree_to_Speaker button or Disagree_to_Speaker button (multiple times but only one button). And when the screen initializes again, then I am only able to click one button but I can click that one buttons so many times.
You need to set one default option. Either sound off or on. For example, make the sound on by default. When the user does not want the sound, he will simply turn it off.
How can I do that? And also if again the user wants to make the sound on, then how the user do that?
Do you want two-button or one-button versions?
Here's an example with one and two buttons. The selected option is remembered even after closing the app.
soundexample.aia (3.2 KB)
Here is an example using the text of a single Start/Stop button to control speech output ...
This board clips the bottom of long images.
You have to click on them to see the rest, or right click on them to see them in a new tab.
The sound block was a procedure, further down in that image.
Thanks for your fast reply
Can you please tell, why you use 'toggle' and 'clock' block and how you do that?
Can you please send the explanation for all blocks. Please!!
The clock is just an example for sound generation. You don't have to have a clock, but wherever you generate sounds you have to use the if condition block and do it like I did in the clock block.
This example shows a method with one button (togle) and two buttons (on and off). If you use one of these ways, the blocks from the other way can be removed.