Use of List String blocks in Sketchware android projects

A string list is an ordered collection of strings, where user has precise control over where in list each string is added. Use of list blocks in Sketchware projects is described below.

Adding elements to list

Elements can be add to a list one by one, and they take the position as per the sequence in which they are added.
For example, if we add Google, Yahoo, Amazon, YouTube, and Android to a list, they will take positions 0, 1, 2, 3, and 4 respectively.
If a very large number of elements are to be added to the list, as in some kind of word game, then multiple more blocks can be used to add elements to the list, and the more blocks can be used in a sequence in the event where list is to be created.
The images below show an example.



An important aspect of lists is that they allow duplicate elements and they allow multiple null elements.

Using List elements in Spinner or ListView

Elements added to a list can be shown in Spinner or ListView by setting their data to the list, as shown in the images below.
  a. Use of list in ListView

  b. Use of list in Spinner


Use of individual list blocks

1. Add...to List String...
This block is used to add elements to a list, as described above.

2. Inset...at...to List String...
This block can be used to insert an element at a particular position in between a list. If an element is inserted at position 3, the previous element at position 3 will shift to position 4, and all other elements at later positions will shift to one higher position.
The blocks used in the image above will give following result.
3. Delete at...of List...
This block can be used to delete an element from a particular position in list. All elements at higher positions will then shift down by one position.

4. Get at...of List String...
This block gets an element from a particular position in list.

5. Index...in list string...
This block gets the position of an element. For example, if Yahoo is at position 1, index Yahoo in List String will return result 1.

6. List String... contains...
This block checks if a particular string is there in the list.

7. Length of List...
This block gets the number of elements in the List. It counts from 1 to the last element. Thus, length of list is one higher than the last position in list.

8. Clear List...
This block deletes elements from all positions of the list.

Comments

  1. Thanks but
    How can I direct/define user selections of the spinner data

    ReplyDelete
  2. I need to move data from from fire base to client(no problem) then I need that added to a local list map ( I might be doing something wrong there) and finally I need that to customview data (on running code when data has been added I get error null object refrence) this is for a chat app so that time stamps are accurate for all users. I am having another issue withthe same area of the app one item of the list is an image which ive followed your totorial on converting to and from base64 and i can load it else where but in listview i get a transparent image. please post a reply or a tutorial thank you love your work.

    p.s. you should post an email just for help requests

    ReplyDelete
    Replies
    1. Ok ive made some progress on my issue i on data added i have the children to map list then to individual string lists then add x key x added to list localchat (like in the list of apps example) and then i set listview1 set custom view data to list localchat but only the text string is being displayed my other textviews are showing up blank

      Delete
  3. Hi, my crash-generated SketchWare application when I use more than two "get value of" to get data from Firebase. How to fix?

    ReplyDelete
  4. Hi please provide me the block program for select language button.

    ReplyDelete

Post a Comment

Popular posts from this blog

A Flash Light App in Sketchware

Create Music Player app in Sketchware

In Sketchware: How to create a calculator for any simple formula?

Simple car racing android game in Sketchware

Firebase auth in Sketchware for Login Activity