Questions tagged [postdelayed]

176 questions
0
votes
3 answers

Using handler/runnable to delay the resubmission of a method

I want to run the getVehicles() method every 10 seconds, I have the following code: Handler vehiclehandler = new Handler(); final Runnable vehiclerunnable = new Runnable() { public void run() { getVehicles(null); …
Seb
  • 410
  • 1
  • 6
  • 20
0
votes
1 answer

Bumping the mole changing the picture but the mole not coming back

I made a game that you should bump the mole. I am using postDelayed to make the mole appear and disappear every few seconds. The problem is that when I touch the the mole, it turns to the squeezed mole picture and the mole disappears (as it should),…
cfircoo
  • 417
  • 2
  • 8
  • 23
0
votes
1 answer

Changing postdelayed method every entrance

I have to change ttyS1 port's baudrate every second. So i need to wake-up remote machine on 9600 Bauds and after communicate with it on 19200 Bauds. But there is a time limit between wake-up signal and real data communication. I use Handler&Thread…
babur
  • 11
  • 2
0
votes
1 answer

Load images and checkbox in a HorizontalScrollView

I got the following onClick command for a button. But when i call it nothing appears CODE: public void onClick(View v) { Log.d("debug", "before loadGutschein"); loadGutschein(); …
0
votes
2 answers

Android high CPU usage

So, I have one problem, which I can't solve. My app used over 45% of cpu samsung SII. I think the main reason is postDelayed. Here is part of my code: Handler a=new Handler(); a.post(new Runnable(){ @Override …
yota9
  • 37
  • 1
  • 3
  • 8
-1
votes
3 answers

How to hide a message after few seconds in Android

I display a message notification to a user and hide that notification after few seconds and I'm using postDelayed() to achieve this functionality but the problem is when I update the notification with new message before hiding the first one, I need…
user3828862
  • 63
  • 11
-1
votes
1 answer

Runnable won't wait for function to finish

I'm trying to run every minute a refresh for the UI. I wrote this code where I have an handler and a runnable with postdelay. Inside my runnable I have a call for a function that is returning a Map object. But every time, my runnable continues to…
Itay Meir
  • 1
  • 1
  • 3
-1
votes
3 answers

I have to update my RecyclerView adapter for every x seconds

I am fetching data from database and showing it into RecyclerView.But I have to update the RecyclerView every x milliseconds/seconds. Here is my code. Please help. @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup…
-1
votes
1 answer

Canceling postDelayed with button (onClick)

help me for the coding. I am not good at coding java and xml, so help. Intro activity shows for 1500ms, and after that, main activity shows. I want to add skip button in intro activity. When the skip button is clicked, I want to skip to main…
-2
votes
1 answer

How to perform click continuously while something is enable

I'm beginner... I need to run some code after 10 seconds continuously while my button is enable. and when I clicked on it and it turned to disable-state, timer get stop. I use below code but it run just once when I click on timerbutton every time…
-3
votes
1 answer

How to use multiple postDelayed handlers

Hi I am new to android delveloping and I am curently making a simple game that tests your reflection when a certain color changes, to test what I have learned so far but I cant solve a problem that came up. Alright, first I will explain how the game…
1 2 3
11
12