Hello. The application contacts the server with a POST request, receiving JSON from it with some data from the database. This JSON is parsed and written to the ListView ( for now, the ListView is updated completely, but not new items are written to it. The ListView contains a list with OT and FOR user messages. A POST request calls SELECT * from the message table, where author = ' $ username ', client =' $ friend ' ). So, I want it to be open with ListView, its update, i.e. The call to the POST request to the server occurred dynamically How can I do that? Using normal Thread'a, causing a POST request every, for example, 3 seconds? (I already did it, but the application dies very quickly)

  • one
    and why does it fall? Show the code, can there be any errors? - Kirill Stoianov
  • For some reason, the NPE drops out in the place where I assign the ListView adapter. NetworkException - lounah
  • if you want to make a chat, then performing requests every 3 seconds to find out if there are new messages is nonsense. For such actions, you can use sockets. - Nikotin N
  • one
    if you have NPE and NetworkException, then why is this not in the question? And yes, as Comrade Nikotin N advises: it’s better to use sockets - Kirill Stoianov
  • 2
    Well, or Firebase cloud message, as an option - Kirill Stoianov

0