an issue with the approach suggested is that your b4a variable doesn't know when it has been modified.
(which, i reckon, is what you have discovered.)
you need a way to receive an event in b4a. that would be one of the "raiseEvent" methods from your library.
when your library receives its event, you call "raiseEvent" and pass pretty much whatever you want back to b4a.
there are several different types of "raiseEvent". use the search box above. almost all my libraries and inline java
use them at some time to communicate asychronously with b4a. that's really the only way you can do it and not
receive an ANR error due to your activity's, ah, inactivity while you're waiting for changes in your list.
if your library is 3rd party, then you'll have to figure out a way to wrap it so that your wrap calls "raiseEvent". if it's
your code, easy peasy. spend some time in the search box above. or if you post representative code from the library,
perhaps an example might find its way to you.
UPDATE:
you need to call raiseEvent from your library so that b4a (meaning you as coder) knows
something has happened. in this case a variable has been modified. otherwise,
you can't make coding decisions based on some variable's value because you have
no way of knowing when it changes (unless you sit in a loop waiting until it does change.)
there are, however, a couple other ways for the b4a portion of the app to be updated.
these might apply if you don't actually care when a variable is modified because you
don't make any decisions based on its current value.
for example, if you had a label that displayed some value derived from the library.
this can be done without raising an event, and it is possible to update a b4a view from
a library (it would use something similar to the suggestion made by
@MicroDrie:
the label is passed to the library, and the library updates the label's text.) but, here
again, you have no way of knowing when - or if - an update ever occurs.
another possibility is what's called an observer. android has undergone several
iterations (i think it's called "live data", but even that may have been updated).
normally, views have listeners (eg, button tap), but not variables (you don't "tap" an
integer). observers are sort of listeners for variables. there is a b4a library, but
i don't know how up-to-date it is.