Android Question [Solved] jmqtt with CustomListView

AymanA

Member
Licensed User
I am developing an app that works with CustomListView and jmqtt.

So the current process of the app is:

It start by connecting to the MQTT broker(data is retrieved from descoveryDB.db to connect to the broker).
Retrieve the topics from descoveryDB.db.
subscribe to each topic in the descoveryDB.db.
Use CustomListView in Main module to populate buttons with the same number as exist in the descoveryDB.db (It also retirve label for the Group - it is just a label)
*****All the above works fine with no problem******
When broker message is received, setstate is called and I am trying to add the value (payload in the mqtt realm) to each button that were populated with the CustomListView.

Note: Message received is not sequential every time, next time you run the app it might change different button.text value.


I have succeeded in that for some of the values that are retrieved (3 or 4 buttons shows the retained message on the button value (either ON or OFF), but for some not obvious reason to me it fails after adding either the third or 4th value/payload ( want to populate the number of values that I am already subscribed to).

It is already working for 3 or 4 values retrieved, why does it fail for the rest, I really appreciate if someone can help me with this!

The error that is received on the log is:

B4X:
Error occurred on line: 132 (Main)
java.lang.RuntimeException: Object should first be initialized (View).
Note: I have added break point for the line that will fail on the 3rd or 4th value retrieved.
payload are retained in the broker already, so you can use it directly for testing.

Thank you for your help with this!

upload_2019-4-13_19-11-36.png
 

Attachments

Last edited:
Top