Questions tagged [postdelayed]
176 questions
3
votes
1 answer
Self-updating every 10 seconds widget Handler.postDelayed problem
I'm trying to make work a self-updating functionality in an Android widget, something simple as changing two TextViews of it every 10 seconds. The ideal solution would be to make it similar to the genie widget (news & weather). And so far, it works…

Nacho L.
- 9,582
- 2
- 25
- 25
3
votes
3 answers
Why doesn't Handler trigger alert as expected?
I need my app to trigger an alert a specified amount of time after a user presses a button. The documentation makes it look like Handler is what I need, and usage appears to be brain dead.
However, I'm finding that despite using postDelayed, my…

Kyle Banerjee
- 2,554
- 4
- 22
- 30
3
votes
3 answers
When are runnables posted in postDelayed actually executed on Android?
There is a piece of code where I use postDelayed and some other code executed on the main thread. I ran it a few times and always saw the following output:
07-13 14:22:18.511 15376-15376/sample1.com.sample_1 D/MainActivity: i
= 0
....
07-13…

Maksim Dmitriev
- 5,985
- 12
- 73
- 138
3
votes
1 answer
Handler postDelayed in Android Service
In my app there is a Service that is intended to run constantly in background once started. This service is started from an Activity and this is the onStartCommand() method:
MyService:
....
@Override
public int onStartCommand(Intent intent, int…

Sebastian Breit
- 6,137
- 1
- 35
- 53
3
votes
2 answers
Android - Question on postDelayed and Threads
I have a question about postDelayed. The android docs say that it adds the runnable to the queue and it runs in the UI thread. What does this mean?
So, for example, the same thread I use to create my layout is used to run the Runnable?
What if I…

Chris
- 545
- 1
- 10
- 17
3
votes
3 answers
postDelayed blocking ui thread
What I want: The user keeps the button clicked for 1900ms. If he picks his finger before 1900ms the phone stops vibrating. While if he keeps his finger on the button for more than 1900 sec, calculate() method runs.
I am using: postDelayed as I read…

Prashant Skywalker
- 51
- 1
- 6
3
votes
1 answer
Get remaining time when using handler.postDelayed
I am using handler.postDelayed method to create some delay for some animation stuff.
Like this:
Handler h = new Handler();
h.postDelayed(new Runnable() {
@Override
public void run() {
// Start Animation.
}
}, 6000);
Later, How can I get…

Hemanth
- 2,717
- 2
- 21
- 29
3
votes
1 answer
Handler.postDelayed(...) does not delay the Runnable
i've implemented an OnCompletionListener by myself which looks like this:
public class SongEndCompletionListener implements OnCompletionListener{
String nextView;
Context actualActivity;
int stopTime;
public…

Flo
- 325
- 2
- 6
- 18
3
votes
1 answer
SignalR serverSentEvents on Windows Server 2008 with IIS 7 POST request taking too much time to complete
I'm using SignalR 2.0.0-beta2 and it's behaving strangely in production environment where an ASP.NET MVC 5 [ .NET Framework 4.5 ] app is installed on Windows Server 2008 with IIS 7. The AppPool is in Integrated Mode and only has this app.
The GET…

Leniel Maccaferri
- 100,159
- 46
- 371
- 480
3
votes
3 answers
AnimationListener's onAnimationEnd not triggered when postDelayed is used
I am trying to use a splash screen to cover the Google Map loading delay (for Maps v2).
I want to use an ImageView in a FrameLayout that should fade out after a few seconds and be able to override the onAnimationEnd to hide the splash screen's…

mirel.cocosila
- 61
- 1
- 5
3
votes
1 answer
Sleep oder wait in For-Loop
I'm trying to turn the LED on and of for a particular lenght (out_tic), based on a given Text in Morse-Code(Text).
I tried to solve this with a "postDelay" and also with sleep() or wait() , but the flash has allways the same lenght or the app…

coemu
- 195
- 1
- 11
3
votes
2 answers
stop handler.postDelayed when moving to another tab in tabview
in my apps, i'm using tabview. inside one of the tab i implement a refresh function such as:
private final Runnable r = new Runnable() {
public void run() {
mVar = true;
while (mVar == true){
calculateResult();
…

Thomas
- 55
- 1
- 8
2
votes
1 answer
Is there a timeout for Handler.postDelayed?
If I want to start some action from the service via Handler.postDelayed, can I start that action a couple of days ahead? Or there is some king of timeout for this, e.g. 12 hrs, 24hrs, etc.?
I am asking this as I think that the action does not…

sandalone
- 41,141
- 63
- 222
- 338
2
votes
2 answers
How can I use Intent in postDelayed using Android?
This is for a splash screen. I've followed the tutorial but it's still not working. It keeps on getting an error.
This is my code:
package id.ac.umn.finalproject;
import androidx.appcompat.app.AppCompatActivity;
import…

Hillary Dorothea Kristianto
- 25
- 1
- 5
2
votes
1 answer
Handler - PostDelayed method "break" the rest (block) of code?
If a code is within Android's postdelayed method, and just below it is more code, does postdelayed lock everything?
Example:
final Handler handler = new Handler ();
handler.postDelayed (new Runnable () {
…

luke cross
- 321
- 1
- 2
- 19