android-handler 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
7
In android , Handler can be used to post / handle message, if I don't use a HandlerThread (pass its Looper to Handler), does that mean in this case Handler use MainThread (UI Thread) 's Looper ?
...
Micah asked 23/5, 2012 at 3:13
7
final Handler handler = new Handler();
LOG.d("delay");
handler.postDelayed(new Runnable() {
@Override public void run() {
LOG.d("notify!");
//calling some methods here
}
}, 2000);
The "delay"...
Fop asked 30/4, 2016 at 0:3
2
I've been wondering about whether it is a better approach to use a Handler (Looper.getMainLooper()) or launch a new Coroutine Job to do small things on the Main Thread, like updating a View.
Handle...
Equivalent asked 22/2, 2021 at 13:56
4
First of all, I know how to create Handler.
I am working on a project where I am using Handler with postDelayed. There are some times when app got crashed because activity was destroyed and the tas...
Hypnotist asked 12/1, 2021 at 12:1
3
Solved
I've created an image upload AsyncTask based on a function. And after uploading, I get this error on onPostExecute(). I read up some StackOverflow answers on Runnable yet I kept getting the error o...
Showthrough asked 13/8, 2012 at 14:10
9
Solved
I have a Handler from my sub-Activity that was called by the main Activity. This Handler is used by sub-classes to postDelay some Runnables, and I can't manage them. Now, in the onStop event, I nee...
Unchaste asked 4/5, 2011 at 12:48
8
Solved
I'm developing an Android 2.3.3 application with a service. I have this inside that service to communicate with Main activity:
public class UDPListenerService extends Service
{
private static fin...
Daffodil asked 10/7, 2012 at 6:42
6
Solved
I call multiple Handlers by new Handler().postDelayed(new Runnable().....
How can I stop it when I click on back?
public class MyActivity extends AppCompatActivity implements OnClickListener {
...
Dyann asked 28/3, 2014 at 17:0
20
Solved
How do I fix the deprecation warning in this code? Alternatively, are there any other options for doing this?
Handler().postDelayed({
context?.let {
//code
}
}, 3000)
Tannic asked 4/4, 2020 at 4:58
5
Solved
I have a countDownTimer and if the user does not hit the gameButton within the 12th second I want the gameOver method called.
The problem is that either the game function instantly gets called when...
Chinaman asked 21/2, 2017 at 22:36
1
I saw this example and I'm wondering is there any objective reason to implement this using Coroutines delay instead of Android Handler postDelayed?
In case the link dies the code from example is b...
Hanoverian asked 24/9, 2019 at 9:8
3
Solved
Handler(android.os.Handler.Callback) is deprecated what should I use instead?
Handler handler = new Handler(new Handler.Callback() {
@Override
public boolean handleMessage(@NonNull Message messag...
Rundell asked 28/11, 2020 at 8:57
16
Solved
In an android service I have created thread(s) for doing some background task.
I have a situation where a thread needs to post certain task on main thread's message queue, for example a Runnable.
I...
Sos asked 20/6, 2012 at 16:7
9
Solved
When I need something to run asynchronously, such as a long running task or a logic that uses the network, or for whatever reason,
Starting a new Thread and running it works fine.
Creating a Handle...
Killdeer asked 19/12, 2012 at 14:33
6
Solved
I am trying to use a Handler in my app. However, when I instantiate it like this:
Handler handler = new Handler();
I get the following error:
Gradle: error: Handler is abstract; cannot be instant...
Killer asked 9/11, 2013 at 6:20
1
Solved
I have this code executed in Kotlin android project and it will log both messages. If I change the token to Char or String it will print only one message which is the wanted behaviour. Same use-cas...
Misestimate asked 16/6, 2020 at 9:58
3
Solved
I'm trying to build an Android app which will repeatedly run some process every 10 mins.
As I found out Handlers are more reliable than timers or scheduling. So I'm going to develop my app using th...
Weathersby asked 4/10, 2014 at 7:36
6
Solved
I want make an app that call a function for example every 10 sec.
I wrote my code like this:
Handler ha=new Handler();
ha.postDelayed(new Runnable() {
@Override
public void run() {
//call fu...
Coetaneous asked 4/2, 2014 at 13:27
3
Solved
Java code:
private final Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
// code here
}
};
How to convert this java code to Kotlin?
I tried this:
priv...
Cindiecindra asked 26/8, 2018 at 10:10
7
I have an app which has a feature A which should run in background every minute. Feature A is that the app should connect to a database, read some data then get the current location of the device a...
Spraddle asked 22/3, 2017 at 22:2
13
Solved
I got slightly confused about the differences between Handlers, AsyncTask and Threads in Android. I've read quite a few blogs and questions here in StackOverflow.
Handler are background thr...
Kunkle asked 6/8, 2011 at 0:37
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
2
I got this stacktrace while I came back to my activity from Google Admob's rewarded video screen after completing whole video. Its just warning, not crash.
onRewardedVideoAdClosed() method is calle...
Pressurecook asked 6/6, 2016 at 4:13
4
I am getting null pointer exception randomly, usually it works and sometime it crashes, I had searched a lot but didn't get any help as it there is no proper line from where I get any help,
I am a...
Godin asked 23/11, 2015 at 5:17
1 Next >
© 2022 - 2024 — McMap. All rights reserved.