Questions tagged [android-handler]

A Handler allows you to send and process `Message` and Runnable objects associated with a thread's `MessageQueue`. Each Handler instance is associated with a single thread and that thread's message queue. When you create a new Handler, it is bound to the thread / message queue of the thread that is creating it -- from that point on, it will deliver messages and runnables to that message queue and execute them as they come out of the message queue.

A Handler allows you to send and process Message and Runnable objects associated with a thread's MessageQueue. Each Handler instance is associated with a single thread and that thread's message queue. When you create a new Handler, it is bound to the thread / message queue of the thread that is creating it -- from that point on, it will deliver messages and runnables to that message queue and execute them as they come out of the message queue.

848 questions
0
votes
0 answers

Starting another activity in Handler#postDelayed(Runnable, long) yields "SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length"

When I start an activity in Handler#postDelayed(Runnable, long) I get an error log message (yes, repeated twice): 03-19 18:39:26.628: E/SpannableStringBuilder(11502): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 03-19 18:39:26.628:…
Maksim Sorokin
  • 2,334
  • 3
  • 34
  • 61
0
votes
1 answer

Handler not fetching data to View

I am trying to pass message using handler to View class; but don't know where I am going wrong. Please correct me. I never used canvas to draw after getting values from Handler. Thanks in advance! My log-cat is showing NullPointerException on onDraw…
Neha Somani
  • 102
  • 2
  • 11
0
votes
2 answers

Updating UI using a Handler freezes my app

I am trying to make a clock, using a TextView :) Someone here told me that I couldn't use normal threads to change the UI, but Handler or AsyncTask. I managed to get it working a few days ago, but was not a consistent thread. Now what I want is a…
TiagoM
  • 3,458
  • 4
  • 42
  • 83
0
votes
1 answer

onActivityResult() is not called when acquiring wakelock globally and setResult() defined in handler.postDelayed() block

I have some code that gets executed when the screen is on, but when I power off the screen, has some problems in execution(even after acquiring Wakelock globally). I have a service that acquired a wakelock and calls the activity - ExecuteScript with…
0
votes
1 answer

In App Purchase problems

Working on my latest app I am implementing In app purchases. I have looked for good tutorials online and found one from Bundell. I went over the code quite a few times, but I keep getting an Error. Looks like this: 01-30 21:14:17.415:…
0
votes
3 answers

How can I show a DialogFragment within a Handler?

I would like to show the user a message, if something went wrong in a network communication thread. For this reason it´s necessary to show a dialog from a handler. Is this the right way?, because I have found no way, how to get a FragmentManager…
Chris
  • 521
  • 1
  • 5
  • 14
0
votes
4 answers

Updating UI of Android activity from some other class running on different thread

I have a activity with a Listview and a adapter attached to it. I have a class which syncs data and hold it. (I think we should not care about from where data is coming) and it runs on a different thread. Now I want to know the clean way to update…
user1875798
  • 263
  • 3
  • 6
  • 16
0
votes
1 answer

Android Handler actions not being processed

I am attempting to pass a message from a Thread to the Handler however, the Handler actions of the handler switch statement are never being processed. This is my Handler: private Handler mHandler = new Handler() { @Override public void…
user1909680
  • 95
  • 1
  • 3
  • 12
0
votes
3 answers

Handler will not be called in my activity

I created a Handler in my activity. The handler will be stored in the application object. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.action_activity); appData =…
Al Phaba
  • 6,545
  • 12
  • 51
  • 83
0
votes
2 answers

Is application alive ? android (Handler issue)

handler.postDelayed(new Runnable() { public void run() { if (MainTab.isRunning == true) ; { Dialog.show(); } } }, Sec *…
Janek
  • 101
  • 1
  • 1
  • 13
0
votes
1 answer

Handle process in AsyncTask Android

I am having two tasks running in doInBackground(). One task is reading data from site and another task is parsing xml file from Url and set image in imageview. But i want to separate both tasks means once the reading from the site is completed , it…
Zankhna
  • 4,570
  • 9
  • 62
  • 103
0
votes
1 answer

Audio android does forces closes app

I have created an audio player with a list view of songs, when the user clicks on an item of the list view the music player starts and a button to pause it, all this worked fine! My next stop i implemented a seek bar to update progress of the song…
0
votes
1 answer

android alarm with background goes

In one of my application I am providing multiple alarm and its working perfectly fine. I want to extend that alarm features with some background internet related tasks. When alarm is set for particular given value application start checking for…
0
votes
1 answer

Android Call more than one Web services in AsyncTask

I am working on AsynTask, single url call from AsynTask fine but i want to call two web services one after other in AsyncTask, can you please send some code or idea. My code: public class GetInstructionItems extends AsyncTask
Ravikumar11
  • 429
  • 2
  • 9
  • 15
0
votes
1 answer

Accessing Activity from Thread Using Listener

I have two classes: An activity class that controls several widgets and then a custom SurfaceView class that implements a Thread. (Fairly common). I have implemented a simple custom listener in the SurfaceView class that I can trigger whenever…
SeaNick
  • 501
  • 1
  • 4
  • 14