android-handler Questions

5

Solved

I am using handler.postDelayed() to create a waiting period before the next stage of my app takes place. During the wait period I am displaying a dialog with progress bar and cancel button. My pro...
Cochrane asked 7/12, 2010 at 15:45

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

4

I am using a handler in the following program and I want to stop it when i=5 but the handler doesn't stop and run continuously. b1.setOnClickListener(new OnClickListener() { public void onClic...
Despond asked 7/9, 2013 at 7:48

3

Solved

I'm trying to use this article to create asynchronous UDP socket. So I've this code: import android.os.Handler; import android.os.HandlerThread; import android.os.Message; import java.net.Datagr...
Ensample asked 17/5, 2017 at 8:53

4

Solved

@Override public void onUserInteraction() { Handler handler = new Handler(); handler.postDelayed(new Runnable () { public void run() { finish(); } }, 5000); handler.removeCallbacks(nul...
Fling asked 25/9, 2017 at 10:32

6

Solved

I'm attempting to create a Handler thread in my application however Android Studio marks my text as red and will only attempt to import the java.util version of a handler and not the Android SDK ve...
Burtburta asked 15/6, 2013 at 7:27

3

Solved

Sometimes we need to delay a code before it runs. This is doable by the Handler.postDelayed(Runnable) or CountdownTimer. Which one is better in terms of performance? See the sample code belo...

6

Solved

I am using a Loader in my application and based on the result I get from the query I perform on COntacts using this Loader I perform some calculations and store them back in a Sqlite DB. I want thi...
Chunk asked 29/11, 2013 at 5:50

4

Solved

I'm trying to wrap my head around threading, and I know that I may use a Handler to post messages/runnables to the MessageQueue, which in turn gets picked up by the Looper and sent back to the Hand...
Glantz asked 4/3, 2011 at 12:48

3

I'm working with the legacy code and I found an inconsistent behavior in this function: @Override public void openFragment(final Class<? extends BaseFragment> fragmentClass, final boolean a...
Etter asked 18/8, 2017 at 9:23

8

I wanted to know if there is a possibility that we could handle/detect runnable callbacks with delay (postDelayed method) on android? For example, I have one or several splashscreen (which runs wi...

3

Solved

I'm trying to restart service from itself in a few time. My code looks like this (inside the onStartCommand(...)) Looper.prepare(); Handler handler = new Handler(); handler.postDelayed(new Runnabl...
Celina asked 29/4, 2015 at 10:38

4

Solved

I am trying to implement AsyncQueryHandler because I am experiencing the same exact problem in this link but I dont see any example or anything about implementing it. I tried doing AsyncQueryHan...
Shinbone asked 14/8, 2012 at 22:40

1

Solved

The question Repeat a task with a time delay? talks about a repeated task within an activity. The top voted answer looks good for that situation. I am trying to make a blinking cursor inside a comp...
Orientate asked 12/6, 2017 at 11:5

2

Solved

I am trying to programmatically raise the volume to the STREAM_MUSIC stream's maximum value, but I am having a "Sending message to a Handler on a dead thread" issue when I do. Also, it seems like i...
Trunk asked 11/3, 2013 at 21:48

4

Solved

I'm wondering when should I use handler.post(runnable); and when should I use new Thread(runnable).start(); It is mentioned in developers documentation for Handler: Causes the Runnable r to be...
Quadruplet asked 28/2, 2013 at 13:0

1

Solved

From the beginning I though Handler's methods post() and postDelayed() did things in a different thread from UI thread, and I decided to create a TCP Socket on it, but it's not working. I'm receiv...
Mythical asked 27/2, 2017 at 16:4

3

In a service which method of delayed execution to be used handler.postdelayed or Alarmmanager. what are the pro and cons. I have 2 services (a) which does background processing and updates the UI ...

1

Solved

According to the documentation of Handler.postDelayed(Runnable r, long delayMillis): Causes the Runnable r to be added to the message queue, to be run after the specified amount of time elapses...
Storey asked 18/1, 2017 at 20:35

2

Solved

I know this is the question which was asked many many times. However there is something I never found an answer for. So hopefully someone can shed me some light. We all know that AsyncTask and Thr...

2

I am trying to implement the PauseHandler described here: https://mcmap.net/q/159989/-how-to-handle-handler-messages-when-activity-fragment-is-paused My activity is an ActionBarActivity, the code...

0

The error appears in RecyclerView Adapter on different versions of android and devices. Im retrieving information about download progress every second and show percents on item layout. @Override...

3

Solved

I have a fragment with a button. When clicked it tells a service to start polling sensors and then insert the sensor data into a database on a background thread. When the button is pushed again, th...

4

Solved

There is a service that listens for some voice. If voice matches a string a certain method is invoked in the service object. public class SpeechActivationService extends Service { public static...
Cloak asked 15/2, 2013 at 14:12

1

Solved

(NOTE: I am re-writing my question because my first version was inaccurate). Given the following code: Handler handler = new Handler(); Message msg = handler.obtainMessage(12345, 67890L); handler...
Ardeliaardelis asked 23/3, 2016 at 23:46

© 2022 - 2024 — McMap. All rights reserved.