runnable Questions
4
i 'm rotating image with runnable.i want to rotate image for example 4 th time and then pause/stop rotate.i wrote some function
public void rotateImage(final View myView, final int size) {
runna...
Aedes asked 24/10, 2014 at 10:19
3
A Java Thread's run() method is called by the JVM, on that thread, when the thread starts. To give a thread something to do, you can make a subclass of Thread and override its run() method, or (pre...
6
Solved
I have a class which implements the callable interface. I want to schedule a task for the class using scheduleAtFixedRate method of ScheduledExecutorService interface. However scheduleAtFixedRate n...
Duncan asked 21/4, 2016 at 18:24
21
Solved
Let's say I have an application that utilizes the Executor framework as such
Executors.newSingleThreadExecutor().submit(new Runnable(){
@Override
public void run(){
// do stuff
}
}
When I ru...
Overmatch asked 24/5, 2011 at 16:33
11
Solved
I have a need for a "Runnable that accepts a parameter" although I know that such runnable doesn't really exist.
This may point to fundamental flaw in the design of my app and/or a mental block in...
4
Solved
I am using a Runnable to automatically subtract 20 from a players cooldown every second, but I have no idea how to replace the value of a value as I iterate through it. How can I have it update the...
10
Solved
A method I am calling in run() in a class that implements Runnable) is designed to be throwing an exception.
But the Java compiler won't let me do that and suggests that I surround it with try/cat...
3
Solved
I have extracted a jar file from an eclipse project but it runs too slow. It takes almost twenty minutes to complete and the eclipse project only takes some seconds.
I exported runnable jar with li...
42
Solved
From what time I've spent with threads in Java, I've found these two ways to write threads:
With implements Runnable:
public class MyRunnable implements Runnable {
public void run() {
//Code
}
}...
Mckinley asked 12/2, 2009 at 14:28
5
I try to play a sound from R.raw. inside a Thread/Runnable
But I can't get this to work.
new Runnable(){
public void run() {
//this is giving me a NullPointerException, because getBaseContex...
Debacle asked 6/10, 2010 at 17:46
3
Solved
I have some code which sets a timer, but if a user sets the timer while it is in use I need to remove the runnable which runs the timer and start it again. But when no handler callback runnable exi...
3
Solved
Is there any simple solution to save data into database using JPA in a new thread?
My Spring based web application allows user to manage scheduled tasks. On runtime he can create and start new ins...
3
Solved
I have a logging code which needs to be executed after all Threadss are executed.
Thread t1 = new MyThread();
Thread t2 = new MyThread();
t1.run();
t2.run();
doLogging();
Is there any way to e...
Ochs asked 29/9, 2009 at 11:51
3
Solved
What I have is an activity with a severer, and another activity with different information on it. However when I open the non-sever activity the sever closes. Is there a way that I can get this to ...
Anthropomorphic asked 19/6, 2012 at 13:46
14
Solved
What is the difference between using the Runnable and Callable interfaces when designing a concurrent thread in Java, why would you choose one over the other?
Heracliteanism asked 26/9, 2008 at 19:0
3
I am having a small issue, when i comment out the binding.setData(dataContainer); in onChanged while observing Livedata in my Activity, I am not able to update the UI, when I uncomment it, the UI i...
Epicalyx asked 7/5, 2018 at 11:48
3
Solved
Seeing some stranger behavior in Java regarding functional interfaces with void return type.
Can someone please explain why the declarations for task5 and task6 below compile?
public class Test {
...
Oleum asked 11/3, 2021 at 17:50
7
Solved
I have a function that needs to perfom two operations, one which finishes fast and one which takes a long time to run. I want to be able to delegate the long running operation to a thread and I don...
Erythroblast asked 20/4, 2010 at 16:8
1
Solved
My question is related to this question, which already has an answer:
yes, there is a happens-before relationship imposed between actions
of the thread calling invokeLater/invokeAndWait and action...
Solan asked 23/10, 2020 at 9:26
11
Solved
I want to use an anonymous class for Runnable. There are two ways, but I don't know if they do the same thing or not:
Method one: using Runnable directly and then calling run():
new Runnable() {
...
Drugget asked 7/10, 2012 at 18:21
6
Solved
I have question which puzzles me.
Imagine I wanna do something in another thread, like fetching GPS/Location stuff, which as recommended in the SDK documents, must use a background thread.
So h...
Puissance asked 4/7, 2013 at 16:26
5
Solved
Ok, I have the following code.
public class MyProgressBar extends JPanel implements MyData, Serializable {
/**
*
*/
public static final int MAX = 10000;
public static final int WIDTH = 400...
Roderick asked 3/5, 2012 at 18:52
3
Solved
This is my code by now:
public class discoverRunnable implements Runnable{
InetAddress address = null;
boolean discovered;
public discoverRunnable(InetAddress address){
this.address = address...
5
Solved
I am calling from a method:
myHandler.postDelayed(mMyRunnableHide, 6000);
which calls:
public Runnable mMyRunnableHide = new Runnable()
{
public void run()
{
mTextDisplay.setText("");
Disp...
5
Why doesn't the first of the following examples work?
run(R::new); method R.run is not called.
run(new R()); method R.run is called.
Both examples are compiled-able.
public class ConstructorRe...
Brownedoff asked 7/1, 2019 at 10:15
1 Next >
© 2022 - 2024 — McMap. All rights reserved.