Android Question List question(s)

DPaul

Active Member
Licensed User
Longtime User
Hi,

I am using a list.
After a certain event, i list.add(a type).
The type has several components, such as .who, .where...etc
Then i log(list.get(....))

All this works fine.
Questions:
1. The log seperates the components (in some order) with a comma, that i did not put there, is that automatic ? In other words, the list sees the type components as individual elements ?
2. At the end of the list-record it puts an extra component "isInitialised = false". What is the meaning of that?
3. At closer inspection, the elements of the type are not logged in the same order as they have been "Dim" med. Is that randon ?

Thanks
Paul
 
Last edited:

eurojam

Well-Known Member
Licensed User
Longtime User
2. At the end of the list-record it puts an extra component "isInitialised = false". What is the meaning of that?

you have defined your own type without initializing it....this will raise an error if you will have an array withing your own type like:
B4X:
Type testtype (  name As String, numbers(10) As Int)
If you only have numbers and strings in your type, it doesn't matter ...
 
Upvote 0

DPaul

Active Member
Licensed User
Longtime User

You are right, it did not matter, but I initialised it anyway.
Still puzzled why it logs the "type"-elements in a seemingly random order.

B4a also says that i add the same object to the list more than once.
? Same type, elements have different values?
Seems no showstopper.

Paul
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Still puzzled why it logs the "type"-elements in a seemingly random order.
You shouldn't rely on the output string. This is just used for debugging. If you want to convert it to a string in any specific format then you need to do it yourself.

B4a also says that i add the same object to the list more than once.
Sounds like a bug in your code. See the common mistake explained here: https://www.b4x.com/android/forum/threads/variables-objects-in-basic4android.8385/#content
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…