Questions tagged [postdelayed]
176 questions
2
votes
1 answer
Unit test method with postdelayed
I have a method that makes an API Call after 1 sec. I use Handler.postdelayed to implement this.
Now I am trying to verify if the API call is being made with a unit test.
@Mock
private PlanRepository planRepository;
@Mock
private…

hushed_voice
- 3,161
- 3
- 34
- 66
2
votes
1 answer
Why to use removeCallbacks() with postDelayed()?
I'm trying to understand the functionality, and in particular, one particular reason why we use removeCallbacks()in conjunction with postDelayed() by going through the Fullscreen Activity template provided in Android Studio. In the fullscreen…

WonderfulWonder
- 515
- 1
- 8
- 20
2
votes
1 answer
MapView latitudeSpan / longtitudeSpan not working
I am trying to get the bounds of my mapview but I had the problem that the latitude is always set to 0 and longtitude is always set to 360*1E6. According to this link, that is because it will only offer the right coordinates when the map is fully…

Tim Strijdhorst
- 1,539
- 3
- 14
- 29
2
votes
1 answer
Accuracy issue in creating a simple StopWatch Timer android app
I'm new to Android development.I want to create a stopwatch with precision of 0.01 seconds.Here is part of my code(which I think the problem lies within):
private void runTimer()
{
final TextView timeView = (TextView)…

Zeta.Investigator
- 911
- 2
- 14
- 31
2
votes
1 answer
How to pause Android VideoView after 4 seconds of playing
I Want to pause my video play after 4 seconds of playing, then I want to pop up a message to the user. Can someone point me in the right direct how to pause the video after 4 seconds please. Thanks
V2 Implemented @gogothebee feedback {Now the video…

Cho Hee
- 165
- 1
- 11
2
votes
2 answers
make an IntentService not sleep until it executes a handler.postDelayed runnable
In the onHandleIntent of my my IntentService class, I created handle containing a runnable which should be done after 20 seconds. Unfortunatly my service sleeps or is destroyed before this period.
I tried also with the CountDownTimer, but i had the…

ahmed_khan_89
- 2,755
- 26
- 49
2
votes
3 answers
Post Delay Method - Android
I used postedDelayed method to refresh my Activity, which works fine. But the problem is that even when I press the Back button postdelayed method call back the previous activity..
//handler for 30000 milli-secs post delay refreshment of the…

mavHarsha
- 1,056
- 10
- 16
2
votes
1 answer
waiting forever for Handler.postDelayed to execute
I'm trying to take a photo with the Android camera. I need to wait 1 second or so when the program first starts so that Preview can be initiated and the photo can be taken. I did that with Handler.postDelayed and it works fine.
Now, my issue is I'd…

akka243
- 25
- 1
- 1
- 4
1
vote
1 answer
Using timer with ProgressDialog
I have a method which is list my items from a server. Therefore, this method takes time until getting all the items. So I want to use ProgressDialog for waiting this method. I read some modules but I couldnt find any useful solution.
public…

Merve Gül
- 1,377
- 6
- 23
- 40
1
vote
1 answer
Android delay / scheduling methods concern
I am developing a game for Android 2.1
My game is a card playing game. So, what I want is that after I have clicked on one of my cards and I throw it, I want the AI to play his card after 2 seconds. So, to do this I want one of my instance methods…

Ömer Baykal
- 85
- 8
1
vote
1 answer
Handler.removeCallbacks() doesn't remove callback - Why?
Given the following LogCat trace, which shows that Handler.removeCallbacks() is called (via MyListener.cancelTimeout()) clearly before myTask.run():
08-12 17:29:13.990: VERBOSE/MyListener.setTimeout(2625): TID: 2625, Handler{460a86e8},…

ef2011
- 10,431
- 12
- 49
- 67
1
vote
1 answer
How to Pull the User String into timer.postDelayed
How do I pull the user string into the Handler timer.postDelayed?
public class Quotes extends Activity implements OnClickListener {
ProgressDialog dialog;
private WebView webview;
Handler timer;
Runnable runner;
@Override
public void…

Chris
- 85
- 15
1
vote
2 answers
Incrementing progressbar during a delayed call
I have a delayed call which looks like this:
handler.postDelayed(new Runnable() {
public void run() {
newDeviceBluetooth();
//increment progressbar each thousand millis passed
}
…

Mazze
- 1,354
- 4
- 17
- 35
1
vote
1 answer
Cancel pause/wait on a postdelayed handler/runnable and still activate the paused code
Setup: I have a 4 stage activity that I use a postdelayed handler to pause with two more nested postdelays.
Timeline:
stage1 |CODE FIRES| stage2 |CODE FIRES| stage3 |CODE FIRES| stage4
stage1: deactivated, just shows a custom…

Toclmi
- 99
- 2
- 13
1
vote
3 answers
PostDelayed and Handler not working and run with no delay
I have a list of animated gifs in drawable resource folder in my android project.
I need these gifs played one by one, wait for seconds, and then play the next gif.
but when I run the app, all gifs load very very fast so I can just see the last…

MH2538
- 169
- 2
- 4
- 11