Just wondering if there is a limit on the number of events that a Map can have ?
I am loading events into a map using:
B4X:
Dim Map1 As Map
Map1.Initialize
Map1.Put("Key", "Value")
However, is there a limit on the number of events I can put before the app decides to force close, memory issues etc because there is to many items in the map ?
I haven't come across any errors yet but want to know if it will cause any errors if I keep loading items into the map.
The limit is the available memory. Devices have different memory sizes, so there's no definitive answer to such a question. The space allocated to your Java app ranges from 16 MB on old devices to 512 MB or more on recent devices (with LargeHeap enabled).
Assuming that the strings that you put in the map are not too large then you will most probably never hit any limit.
Even if the user presses on the button 100k times then the memory required for this map is quite small:
100,000 * (5 * 2) [two strings with 5 characters] * 2 [each character requires 2 bytes] * 1.5 [unrealistic 50% overhead for the Map pointers and other small stuff] = 3mb.
Similar to the memory required for a single medium+ image.