Android Question [Solved] jmqtt with CustomListView

Discussion in 'Android Questions' started by AymanA, Apr 13, 2019.

  1. AymanA

    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:

    Error occurred on line: 132 (Main)
    java.lang.RuntimeException: Object should first be initialized (
    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!


    Attached Files:

    Last edited: Apr 13, 2019
  2. DonManfred

    DonManfred Expert Licensed User

    Try this version. Note that i did changed some parts.

    WhatsApp Image 2019-04-13 at 20.29.10.jpeg

    Attached Files:

    Last edited: Apr 13, 2019
    BillMeyer, mangojack and AymanA like this.
  3. AymanA

    AymanA Member Licensed User

    Awesome! it is working like a charm! and more than I have ever wished for!! words can not express my gratitude for your help for real! thank you so much, I am really happy :D
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice