where to put the "main loop"?

Former Member
Former Member

Hi there

I am actually trying to create my first IQ-App. One of the questions which has arised now is: where should i put my main code?

I have built an app which is downloading some tracks from the internet.

My code looks like this:

    function onShow() {
    	mainLabel = View.findDrawableById("id_status");
    	doDownload();
    }


 function doDownload() {
  
  	mainLabel.setText("Start syncing...");
    ....
    Comm.makeWebRequest(url, params, options, method(:downloadCallback));

  }
  
   function downloadCallback(responseCode, data) {
  	mainLabel.setText("Got response");
  	...
  	}

As you can see, i am trying to visualize the state of the download with different label texts.

Unfortunately, all changes which were made in the callback are not updated to the UI.
Therefore i tought i could set a Flag and proceed this flag in my main loop. But wait... Where is my mainloop?

I am looking for something like a

onIdle()

{

}

Function...

Do you have any advice to me?


Thank you