Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid, how to measure an elapsed amount of time
    primarykey
    data
    text
    <p>I'm working on a presentation app, which displays different images. There I wanted to to let the presentation slide through my List of images, video and pdf files, after a short amount of time.</p> <p>I start my different views through intents, <code>startActivityForResult(intent, RESULT_OK);</code></p> <p>Starting videos and closing videos was not an issue. I used <code>onPreparedListener</code> and <code>setOnCompletionListener</code> and everything worked like a charm.</p> <p>With pictures however, this was completely diffrent.</p> <p>I created a new <code>Thread</code> in my <code>ImageView</code> and did put that thread to <code>sleep()</code>, after that I called the <code>setresult()</code> method and <code>finish()</code>. But instead of waiting, the picture wasn't shown at all and the presentation was stuck there, without setting the result and finishing the activity.</p> <p>So I started searching for some explanation of time in android and found this explanation:</p> <p><a href="http://developer.android.com/reference/android/os/SystemClock.html#uptimeMillis%28%29" rel="nofollow">Explanation</a></p> <p>I read through it and tried to get a good grasp on whats explained there. But the more I thought about it, the more I got insecure, which is the best way to implement the waiting behavior for my intended purpose. </p> <p>So instead of some code, I am much more interested in, what you would advise me to use and why with a, if possible, detailed explanation.</p> <ol> <li><code>elapsedRealtime()</code>?</li> <li><code>uptimeMillis()</code>?</li> <li><code>System.currentTimeMillis()</code>?</li> </ol>
    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.
 

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