title: How to execute background job that update UI view Android
body: <p>In my Android application I have an activity with views.</p>
  
  <p>To the beginning of the activity or to the creation of main layout for example, I would like to start a background job that goes to update UI view from main layout for each 5 seconds. </p>
  
  <p>So, my strategy for the moment was to create Runnable during creation of the main layout by using runOnUiThread method of my class that derives from View.</p>
  
  <p>The thread starts correctly but in the thread I would like to do a wait for 5 seconds to wait before update UI view again. My problem is when I use Thread.sleep, the UI is blocked.</p>
  
  <p>I guess Thread.sleep() blocks the entire UI but I don't know how I must make to solve that problem.</p>
  
  <p>So my question is the following : what is the best solution to realize what I want (without using sleep perhaps) ?</p>