Questions tagged [postdelayed]

176 questions
1
vote
0 answers

postDelay vs ScheduledThreadPoolExecutor

I'm trying to produce an animation with delay less than 1 milli second. Based on my research, I found some answers about ScheduledThreadPoolExecutor. Unfortunately, I applied the following code but it's not working as I expected.. public class…
ManKeer
  • 543
  • 2
  • 6
  • 27
1
vote
3 answers

Update postdelay seconds for runnable when page scrolled in viewpager android?

i am displaying images using viewpager and that images will be automatically change after 20 seconds automatically changes images every 20 seconds work perfectly but i want to reset handler postdelayed time if user manually scroll pager and next…
Mahesh
  • 1,559
  • 6
  • 27
  • 57
1
vote
0 answers

Handler executing faster than expected

I am using handler and its postdelayed method to execute a runnable after every 10 seconds. but It looks like it is executed every second. Here is the code: final Handler handler = new Handler(); Runnable runnable = new Runnable() { …
Puneetr90
  • 199
  • 1
  • 6
  • 18
1
vote
2 answers

Display countdown in a toast from postDelayed method?

Using this method i can set a delay in an action i want do: final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { //Do something after 5 seconds } }, 5000); Is there a way to display the…
David_D
  • 1,404
  • 4
  • 31
  • 65
1
vote
1 answer

Android handler: state of variables in postdelayed

OK, I have a question regarding handler. Scenario: Handler mHandler, Runnable mRunnable, int mState. mRunnable is supposed to to something according to the mState. Runnable mRunnable = new Runnable() { @Override public void run() { …
Behnam
  • 6,510
  • 6
  • 35
  • 65
1
vote
0 answers

httprequest handle time delays till having response

I have an application that calls a function to send JSON object to a REST API, my problem is how can I handle time delays and repeat this function till i have a response from the server in case of interrupted network connexion ?? I try to use the…
bourax webmaster
  • 748
  • 7
  • 18
1
vote
1 answer

Alernative to postDelayed method in ScrollView

What I'm trying to achieve is automatically scrolling to the bottom of a scrollview when a new view is added via: mContainerView.addView(newView); This is the code I have currently: bt.setOnClickListener(new View.OnClickListener() { @Override …
Karl
  • 3,394
  • 2
  • 22
  • 31
1
vote
1 answer

How to resume it when i click resume button?

//Counter of time since app started ,a background task private long mStartTime = 0L; //Private long mPauseTime = 0L; private TextView mTimerLabel; //Handler to handle the message to the timer task private Handler mHandler = new…
1
vote
2 answers

Android Game loop using a thread postdelayed()

I thought I was being clever using this code for the game thread loop, instead of the usual while(running) loop: @Override public void run() { Log.d(TAG, "+ run()"); final long [] old = new long [] {…
ilomambo
  • 8,290
  • 12
  • 57
  • 106
1
vote
1 answer

Android postDelayed works but can't put it in a loop?

Sorry I am a noob I've read countless tutorials about making a simple timer and was wondering why it doesn't work until I noticed it is the while-loop causing the issue o.O I have removed it and then it works but only 1 time I need to use the loop…
1
vote
1 answer

android flyin imageView after a certain time

The purpose I aming for is, that 2 seconds after my activity was started an ImageView (with an image) should flyIn to the view. But with the following code nothing happens. Am I on the right way or can I solve this completely different? What do I…
Bruno Bieri
  • 9,724
  • 11
  • 63
  • 92
1
vote
3 answers

Handler postDelayed doesn't post on delayed?

I want to change some values onBackPressed method... And i override it like this: @Override public void onBackPressed() { final Handler backHandler = new Handler(); backHandler.postDelayed(new Runnable() { …
yahya
  • 4,810
  • 3
  • 41
  • 58
0
votes
3 answers

Add delay during adding of view in android

I have a simple animation attached to dynamic textview that i am creating but what i want is to add delay while adding them. Please guide me how to do that. LinearLayout ll = (LinearLayout)findViewById(R.id.ll); final HorizontalScrollView…
Programmer
  • 5,360
  • 10
  • 37
  • 61
0
votes
2 answers

KeyStroke delay for password text in windows phone 7

I am developing a windows phone 7 application. I have requirement where there is a password text box and when user starts typing the letters into the text box, each letter should appear as it is for 1 sec and then get converted to password dot…
EnthuDeveloper
  • 672
  • 9
  • 25
0
votes
2 answers

Change ImageView for a few seconds and pause UI

Sorry, I keep on trying to adapt the tokens, but somehow I can't manage this one. I have the following code: timer.schedule(new TimerTask(){ runOnUiThread(new Runnable() { public void run(){ …
Diego
  • 4,011
  • 10
  • 50
  • 76