runnable Questions

3

Solved

I've been playing about with Runnables and have discovered that if you postDelayed a Runnable on a View then removing the callback won't work, however if you do the same but post the Runnable on a ...
Livvi asked 19/3, 2012 at 10:40

1

Solved

I'm wondering about performance and cpu/ram requirements for 2 different methods of starting runnables I have some code that collects sensor data every 10ms and inserts the values into a database ...
Scissile asked 4/4, 2016 at 5:57

1

I want to create multiple handler and run-able when my app receive response from server. The handlers can be maximum 4 and minimum 1. Problem Actually i want to divide cell screen in different p...
Quart asked 16/2, 2016 at 21:19

2

Solved

I know that implements Runnable is preferred over extends Thread in Java threads as it allows us to extend some other class if it is required. But if this is the case, does extends Thread als...
Dehypnotize asked 22/1, 2016 at 11:22

1

Solved

I can't for the life of me find an explanation of the following: public static void takesAFunction(Function<String, Void> func) { func.apply("Hi I'm running a function"); } public st...
Dimorph asked 16/12, 2015 at 15:53

4

Solved

Is it possible for a Runnable to return a value? I need to do some intensive work on an Editable and then return it back. Here is my mock code. public class myEditText extends EditText { ... priva...
Beeson asked 21/10, 2011 at 2:47

4

Solved

I have an "open" animation and am using Handler.postDelayed(Runnable, delay) to trigger a "close" animation after a short delay. However, during the time between open and close, there is possibly a...
Irregular asked 2/9, 2010 at 12:48

2

Solved

Is it's considered bad practice to use Runnable as a callback? Considering that Runnable is meant to be used with threads (see it's JavaDoc), I'm wondering if this is okay - or whether I should ma...
Aspect asked 28/3, 2014 at 21:35

1

Solved

I need to debug my application and debug the code is part of Runnable and do some actions in application then debug the code again, but I can't do it, I can't do any actions as debug point is fired...
Overplay asked 6/5, 2015 at 13:18

3

Solved

Upon an event, I'd like to run a task/runnable but delay it's execution in 2 seconds. During these 2 seconds, if the same event occurs, I'd like to remove the previous task and re-post it to run -...
Bianco asked 6/5, 2015 at 11:4

2

Solved

I got some operations in my Controller class which could take some time. So I want to show a loading dialog while this operation is running. I tried this: Platform.runLater(new Runnable() { @Ove...
Toper asked 30/4, 2015 at 9:8

5

As an exercise, I tried to create an implicit conversion that would accept a function and produce a Runnable. That way you could call Java methods that accept Runnable objects and use them like clo...
Simmon asked 18/6, 2010 at 23:28

4

Solved

I am a total beginner in Java and have created a simple Java Android snippet where in a Runnable after 1,5 seconds I change the TextView from Hello World to Hola Mundo. It works flawlessly, basical...
Deltoid asked 17/4, 2015 at 8:36

1

Solved

I was using a CountDownTimer for some countdown functionality I have in my Activity. I decided to move away from CountDownTimer and use ScheduledThreadPoolExecutor because CountDownTimers can't can...
Counterweight asked 8/4, 2015 at 18:11

1

Solved

I have a modified version of the bluetooth chat sample app. I have set up a ScheduledExecutorService which sends a command over bluetooth at a predefined rate using scheduleAtFixedRate. I ha...

4

Solved

Let's say I have some unit of work that needs to get done and I want to do it asynchronously relative to the rest of my application because it can take a long time e.g. 10 seconds to 2 minutes. To ...
Linguistics asked 29/8, 2014 at 16:0

6

Solved

I would like to be able to schedule a task at a specific time in Java. I understand that the ExecutorService has the ability to schedule at periodic intervals, and after a specified delay, but I am...
Ferrosilicon asked 9/11, 2011 at 14:3

6

Solved

In an existing Android project I've encountered the following piece of code (where I inserted the debugging litter) ImageView img = null; public void onCreate(...) { img = (ImageView)findViewBy...
Grandiose asked 3/11, 2010 at 2:25

2

Let's assume we have the following code: List<Future<?>> runningTasks; ExecutorService executor; ... void executeTask(Runnable task){ runningTasks.add(executor.submit(task)); } My q...
Judaea asked 11/4, 2014 at 13:53

1

Is there a way to run a string as code? I mean if I had a string run having value System.out.println("Hello World) could I run the string as normal code the then output will be Hello World? ...
Ostler asked 10/7, 2014 at 0:45

0

I noticed that there are submit methods for both Runnable task and Callable task. Why is there only invokeAll for Callable tasks, but no invokeAll for Runnable tasks. Thanks
Durango asked 9/7, 2014 at 3:27

2

Solved

If the handler was instantiated in the main UI thread, does a post with a Runnable create a child thread that gets added to the message queue, or does it just get run in the UI thread? handler.pos...
Injunction asked 6/2, 2012 at 16:24

3

Solved

since several days, I tried to figure out what exactly happens if I execute code in void function(){ //somePreExecutionCode new Handler().post(new Runnable(){ @Override public void run(){ ...
Clement asked 10/4, 2014 at 9:18

5

Solved

As a beginner, I was reading about 2 ways of implementing Multithreading in Java. I read this thread on SO and on many other threads. It is stated that "prefer runnable" , extends ...
Column asked 18/3, 2014 at 9:21

3

Solved

Lately I saw http://developer.android.com/reference/android/os/CountDownTimer.html and wondered if there is an respective class for stop watches since I want to tell the user of my App how long he'...
Arcboutant asked 24/2, 2014 at 7:49

© 2022 - 2024 — McMap. All rights reserved.