I’ve created upto 20 buttons in runtime.
Now upon an event, I want to remove 15 buttons leaving first 5 as it is. How can I do so?
Then whenever another event is called same button will be added as before.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Instead of array, you should use a list. I guess when creating you do something like this:
Then to remove any button from the app again, simply do:
With this set up, to remove the last 15 buttons, try the following:
Remember to let the loop start at the 20th item, and work downwards, because if you delete an element inside a list, that means that all the elements with a higher index will get their index shifted by 1.