runnable Questions

3

Solved

For studying purpose, I am trying to migrate this Java Command Pattern example to PHP: https://codereview.stackexchange.com/questions/52110/command-pattern-implementation As @simon commented, u...
Skyline asked 8/3, 2020 at 21:59

5

Solved

I would like to run a certain code every 5 seconds. I am having trouble achieving this with a handler. How can this be done in Kotlin? Here is what I have so far. Also to note, the variable Timer_P...
Cipolin asked 24/7, 2017 at 18:42

4

I am trying to select recyclerview item randomly with delay.I need to start random selection method after fragment load without any user interaction,But getting the following error. Afterward I put...
Mclain asked 27/1, 2017 at 13:47

5

Solved

Basically I want to use SurfaceView for animation. Therefore the class implements Runnable. To experiment, I want to draw a circle. However, it shows only a black screen. I have been trying for da...
Equalizer asked 23/1, 2014 at 14:53

1

Solved

I currently have a rather simple SSL server/client project that involves a standard Java backend and an Android frontend. I wanted to try to read a response from the server after I send data with t...
Kriskrischer asked 1/1, 2020 at 20:21

1

Solved

I have a JavaFX application that animates robots (black dots) on the screen and paints a little white line on a lighgray background at wherever they've been (think Tron). To do this I keep all the ...
Madrepore asked 20/1, 2014 at 10:31

2

Solved

I need some kind of service that will run a few tasks simultaneously and in an interval of 1 second for 1 minute. If one of the tasks fails, I want to stop the service and every task that ran with...
Reena asked 10/11, 2019 at 17:47

3

I'm try to lern Monodroid! I try to re-write java code to C# and have some problem: I don't understand how-to use Runnable. That's snipet of code in Java, that I coudn't translate to C#: public cl...
Catching asked 20/2, 2013 at 20:13

5

Solved

I tried this way: private Runnable changeColor = new Runnable() { private boolean killMe=false; public void run() { //some work if(!killMe) color_changer.postDelayed(changeColor, 150); } pub...
Pfaff asked 26/2, 2012 at 22:58

1

Solved

I was wondering recently as Runnable is very often used in a functional context. At the same time according to javadoc its semantical meaning is very close to multithreading while it is not aways u...
Hollowell asked 29/6, 2019 at 9:45

3

Solved

I'm looking to get a result from a method which can take a while to complete and doesn't actually return the object, so I'd like to deal with it as effectively as possible. Here's an example of wha...
Beholden asked 14/12, 2015 at 14:7

2

Solved

The code: var shouldStopLoop = false val handler = object : Handler() val runnable = object: Runnable // The error occurs here { override fun run() { getSubsData() if(!shouldStopLoop) { handl...
Caligula asked 17/12, 2018 at 14:35

1

The logcat shows the following error when run application in oppo f1 version 5.1: ANR_LOG: >>> msg's executing time is too long Blocked msg = { when=-15s421ms what=0 target=android.view...
Kowtko asked 20/7, 2018 at 5:4

6

Solved

Or is it? I have a thread object from: Thread myThread = new Thread(pObject); Where pObject is an object of a class implementing the Runnable interface and then I have the start method called o...
Lenis asked 22/4, 2010 at 11:10

8

Solved

The run method of Runnable has return type void and cannot return a value. I wonder however if there is any workaround of this. I have a method like this: public class Endpoint { public method() {...
Eger asked 3/12, 2012 at 13:39

2

I want to post a runnable to a view object inside a runnable , currently i am stuck here. var runnable = Runnable { if(numLinesToDraw >= amplititudes.size){ } else { numLinesToDraw = num...
Acquah asked 29/5, 2018 at 11:2

4

Solved

Hi, I'm newbie in Java Android development and I want to know how to use Runnable in Android. It doesn't seem to be working for me. Here is my source code: MainTest.java package com.heeere.androi...
Charla asked 11/9, 2012 at 9:15

3

Solved

Could someone show me what is wrong? I try to use a Handler post a Runnable but it's not execute var mHandler: Handler? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCre...
Cassicassia asked 21/9, 2017 at 8:25

3

Solved

I needed to have a lambda expression of the functional interface Runnable that did nothing. I used to have a method private void doNothing(){ //Do nothing } and then use this::doNothing. But I'...
Ara asked 7/5, 2015 at 17:58

2

Solved

I was curious why a lambda with a return type can not be casted to a Runnable whereas a non void method reference can. Runnable r1 = () -> 1; // not allowed // error: incompatible types: bad re...
Dunker asked 18/4, 2016 at 14:6

5

Solved

private val progressTask = Runnable { runOnUiThread { if (!tvMessage.text.isEmpty()) tvMessage.text = "" } pbLoading.progress++ when { pbLoading.progress == 600 -> finalFunction() pbLoading...
Lawrencelawrencium asked 23/2, 2018 at 6:54

1

Solved

I was trying to update the recycler view content from a background thread in Kotlin. I am not using AsyncTask. Here is my code, i want to know if there is any better way than this: In my MainActi...
Crosswise asked 6/2, 2018 at 5:24

5

Solved

In my application I have created a calendar with Gridview and in that Gridview I am displaying dates and some availability of events with the help of Imageview and to do this I have created a handl...
Hellen asked 28/1, 2013 at 7:25

14

Solved

Say we have these two Runnables: class R1 implements Runnable { public void run() { … } … } class R2 implements Runnable { public void run() { … } … } Then what's the difference between thi...
Sexed asked 20/12, 2011 at 17:47

2

Solved

I want to update UI every 100ms. After searching in StackOverflow, I found a solution using Runnable and Handler like this final Handler handler = new Handler(); Runnable runnable = new Runnable()...
Inexpiable asked 6/12, 2017 at 8:49

© 2022 - 2024 — McMap. All rights reserved.