Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have to use <code>runOnUiThread()</code> when you want to update your UI from a Non-UI Thread. For eg- If you want to update your UI from a background Thread. You can also use <code>Handler</code> for the same thing.</p> <p><strong>From the Docs -</strong></p> <blockquote> <p>Runs the specified action on the UI thread. If the current thread is the UI thread, then the action is executed immediately. If the current thread is not the UI thread, the action is posted to the event queue of the UI thread.</p> </blockquote> <p><strong>Syntax -</strong></p> <pre><code> Activity_Name.this.runOnUiThread(new Runnable() { @Override public void run() { // your stuff to update the UI } }); </code></pre> <p><strong>Update -</strong></p> <pre><code>AsyncTask - </code></pre> <blockquote> <p>If you want to do some <code>Network operation</code> or anything that blocks your UI in that case AsyncTask is best options. There are several other ways for performing the same Background Operations as you can use <code>Service</code>, <code>IntentService</code> also for doing Background Operations. Using AsyncTask will help you doing your UI work and also won't block your UI until your background Operation is going on.</p> </blockquote> <p><strong>From the Docs -</strong></p> <blockquote> <p>AsyncTask enables proper and easy use of the UI thread. This class allows to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload