Englisch version   Deutsche Version

Version Adjustments
1 (2019-01-12) Initial version
1.1 (2019-01-14) Bug in AddMsg fixed.


When working with MIT App Inventor 2, debugging, especially debugging events, is quite tedious. The "limited string list" presented here is very well suited for collecting debug messages and displaying the latest of them. If a newly recorded message exceeds the capacity of the list, the first entry is removed. The capacity is adjustable.

The highlight of this list, however, are the two methods ToString and ToReverseString. They return the entire contents of the list as a single multiline string, one row for each list item.


The ZIP archive UrsLimitStringList for downloading. The archive contains the source code and the compiled binary and a sample project to upload to the App Inventor.


Block Funktion Anmerkung
Add  Adds a new line to the end of the list. If this addition exceeds the capacity of the list, the first item is removed from the list.
Separator Gets or sets the separator string for AddMsg. Default value is ":␣". Required for AddMsg (next block).
AddMsg Adds a new line to the end of the list.. Line
is added.
Clear The content of the list is deleted.  
Item Gets the item with the number specified in Index. The numbering starts with 1. If the Index entry is outside the valid range [ 0..Length ], an empty string is returned.
First/Last Gets the first or last item in the list. If the list is empty, an empty string is returned.
Length Gets the number of items in the list.  
IsEmpty Returns a boolean value indicating whether the list contains items. Return values are true or false.
ToString Gets the entire contents of the list as a single multi-line string. For each list item, a single row is generated. ToString returns the rows in the order they had been added. ToReverseString does this in reverse order. The individual lines are separated by "\n".
Limit  Gets or sets the capacity of the list. Values < 1 are ignored.
Limit  The initial capacity can also be set in the Designer. Likewise the separator string.  
Events  These events are triggered when the corresponding method of the list block is called.

Each event then fires ContentChanged.
ContenChanged The ContentChanged event is fired when the content of the list changes. ContentChanged fires after the individual events.
EventType Data Message
0: Line added Text "Line added: <Text>"
1: Limit changed Limit "Limit set to <Limit>"
2: List was cleared "" "List was cleared"

Example App

Screenshots of the App

Screenshot   Screenshot


Procedure FillProperties

This procedure transfers the properties of the list to the screen components. This procedure is called whenever something has changed.


Add lines to the list

Add items   cmdAdd adds the text from the input field tbxAdd above to the list.

Add items

Clear the list

Clear the list   cmdClear clears the list.

Clear the list

Set the capacity of the list

Set capacity   cmdLimit defines a new capacity of the list depending on the input field tbxLimit.

Set capacity

Set display order

Define display order   cbxReverseOrder defines the order of the list elements in the lower display field lblConent.


Define display order


For developing own extensions I gathered some tips: AI2 FAQ: Develop Extensions.