Problem in button click event

Hello everyone
I was making an app where I used some buttons to do some events and I gave events to them per click but only the first event was being done and the others were not going on…Can anyone help me regarding this…
Screenshot 2021-07-19 133851
photo of the code included…

Could you please post also other blocks in order to understand better what you are trying to do

1 Like

Did you set initial value for the variable count to 1? Set it in screen initialise and try.

yes initial value is 1


here are the blocks @dora_paz

First of all you can optimize your code and do the same think with less blocks. Also you call tinydb but where do you store data in tinydb ?

the data of tiny db is stored in button images and button links that the activity starter will open, I used list for fetching data from tinydb but that didnot worked so I took 2tags of tinydb

Well ., wait… What did you say initial value as 1… If so then why do calling set click to add with 1???
I am not sure you are following correct algorithum , also as said by dora your blocks can be minimized… You can re try…

I think, tinyDB wont store the images but you can use the link

yes tiny db can store images
my query is that when i click the button for the first time second screen will open and when i will click again then it will open the link provided but its only performing the first task…

I am sure, only this format can be stored in tinyDB or in the form of file path/link/url. But in other form i am sure it wont…

1 Like

Can you tell us, what type of activity you will open with the empty link here?
Still confusing us…
image

image

See the logic, On button click, you will get the count as 1(due to initialize block), then next screen will open also the count will set to 2,OK then, Once you come from another screen, then that click count will be reset to 1, so again and again you will open the next screen only and there is no use of else block as per your algorithm , i think…

@Adriraj_Saha Can you tell us, what type of activity you will open with the empty link here?
Still confusing us…
image

image

See the logic, On button click, you will get the count as 1(due to initialize block), then next screen will open also the count will set to 2,OK then, Once you come from another screen, then that click count will be reset to 1, so again and again you will open the next screen only and there is no use of else block as per your algorithm , i think…

Update:
I hope if you tried in this way, you can reduce the usage of more number of blocsk and error also can be found quickly…


the links are not empty see this image or the complete code you will find it downwards

Thanks for this i will implement this on this app
Can u give this aia

In this post only you have added the link it seems…

Bt i am still confident at any cost this else block will never execute. Suppose if you follow what i have suggest , i am sure it will

image

okay…

1 Like

@Still-learning it looks like your code is having some problems because I made the first screen of your app and there when i click o buttons an error comes saying no corresponding activity was found…

It means you have not assigned the link or activity as i mentioned… Can you show me what you have did?

Sorry, it was my mistake… I didnt use the activity starter. please use this

image

Try this,

Update:
BTW, You have set any browser or webviewer to open in this activity. I have showed what you have tried in the post no.5

2 Likes

ok thanks for identifying