After you get the index value and before you try the removal, you should test if the index is greater than 0. Don't trust it to always be greater than 0. If it is 0, instead notify with an error message, like "Already Removed" or "Not found in Broadcast List" and skip the removal block.
from the Do it result you also can see, that the BroadcastList is empty...
also does it make sense to search for an empty string in an emoty list? not really...
and next time you might want to provide a readable screenshot like this: right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.
Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.
So i tested the app again .
Now the new issue is that when the person types the message βleave β , it will send the automatic message β you have been removed from the broadcast list β but will not remove the person from the broadcast list . What can i do to solve my problem ?
Maybe you can try this again.........
Not working . Tried everything
Pls do u know any other way ?
You are of two minds as to where your broadcast list lives:
- In a global variable
- In a TinyDB tag's value.
Either update both or get rid of one of them.
Please export your project and post it here.
I dont feel comfortable doing that . Is there any other way you can help me . Maybe by explaining to me. You see i have worked a lot on my app and i dont want anyone to steal it . I Hope you understand
My friend gave me an ides that i should remove from tiny DB as it is the one that is storing it. I think that can work
Here's a technique to keep your broadcast list up to date ...
Hide it behind a few procedures, and don't access it any way except through those procedures:
get broadcast list (value procedure):
return the TinyDB read result from the broadcast list tag
add number to broadcast list (number input):
init local list to get broadcast list
add number to local list
save local list to TinyDB tag
remove number from broadcast list(number input):
init local list to get broadcast list
init local index to 0
set local index to (index in list) of number
if index > 0 then
remove index from list
save local list to TinyDB tag
else complain about no such number in list
Once you are using these procedures, get rid of that global variable to avoid confusion.
Hello but the local broadcast list cannot work cause that is not the only group of blocks , there are other ones and so the global brodcast list is what i can use . Do you know any other way ?
The whole idea of using a local list is to hide it from outside the procedure, to force the programmer to use the procedures. This is called information hiding and is intended to encapsulate internal details and protect them from unwarranted interference.
From what i understand you are saying , is it possible i use it only when i want to remove a person from the list ?
These procedures are to be used anywhere you want to read or update the list, without exception.
Here is a sample ...
(My spelling of your tag is from memory. Adjust as needed.)
Notice that there is no global variable to confuse matters.
If returning from another screen, reload the ListView as in Screen1.Initialize.
Thank you so much . Is it possible you could help with another problem but not related to this topic. Its in the topic β adding sender id to sms β , i have a recent post that i posted , no one has responded , i will really appreciate if you could try it out and give me ur advice . Thanks for all the help
It worked but i will have to off the app and on it , is there any way that if the person is removed , it will remove the person automatically without initializing the screen
Is there a way i can change that
Which did you want, initializing the screen or not initializing the screen?
It's up to you to code that after you call the removal procedure. It is a matter of taste.
Actually it works perfectly . Thank you a lot . Pls ABG go the topic β adding sender id to sms β , i will really appreciate your insight
A link would help find it ?
Also, I do not personally maintain an Android phone with cell service, so I skip SMS questions.