Handler is part of the Android system's framework for managing threads. A Handler object receives messages and runs code to handle the messages. Normally, you create a Handler for a new thread, but you can also create a Handler that's connected to an existing thread. When you connect a Handler to your UI thread, the code that handles messages runs on the UI thread. This way results of background work can be moved to UI elements such as bitmaps.
Questions tagged [android-handlerthread]
79 questions
0
votes
0 answers
Unable to open a realm at path: open() failed: Too many open files
I have an android application which I do many realm operations. I tried to use handler threads to faster the database operations however this time I get these errors. I have reviewed similar questions but could not find out the reason.
12-17…

Hilal
- 902
- 2
- 22
- 47
0
votes
1 answer
Stop HandlerThread which has a blocking call in it
I am making network request over TCP/IP and listening to the response on a separate thread. Each time I make a network call, I want to stop previous thread which is listening to response and make a new one.
Unfortunately, older HandlerThread is not…

Ananth
- 2,597
- 1
- 29
- 39
0
votes
1 answer
What is the impact of setting different priority on handler thread?
I'm have a handler thread with thread priority set to background,
myHandlerThread = new HandlerThread(HANDLER_THREAD_NAME,
Process.THREAD_PRIORITY_BACKGROUND);
On this myHandlerThread I'm doing some operation to alter system property by invoking…

gooogle
- 375
- 4
- 16
0
votes
2 answers
How to use onLooperPrepared of HandlerThread in Android kotlin?
I am developing in Android, I want to use HandlerThread to start a countdownTimer like the following code.
private var bgHandlerThread: HandlerThread? = HandlerThread("MyHandlerThread")
private fun startTimer() {
bgHandlerThread =…

Wun
- 6,211
- 11
- 56
- 101
0
votes
1 answer
Android, IntentService vs Custom service with HandlerThread
I have read one post about Android services within threads but there is one thing that I did not understand. In the post the writer uses a custom service because it allows multitasking while IntentService does not.…

JMP
- 75
- 7
0
votes
1 answer
How to call .start on HandlerThread from .map operator
I am learnign how to handle and to use functional programming in Android. So I developed the below code. I would like to handle the HandlerThread as observable, but when I try to call .start() from
.map() operator I receive the following error:
…

user10776303
- 241
- 6
- 16
0
votes
0 answers
Non-static class cant have static variable
I have posted the HandlerThread class where I got an error on the following line:
private final static String TAG_LOG = MainAct.TAG_LOG + "->" + RoomPersistentDBHandlerThread.class.getSimpleName();
The error was inner class cant have inner static…

user10776303
- 241
- 6
- 16
0
votes
0 answers
how to quite a Looper of a worker thread
I wrote the below code to better understand the Handler and the Looper. I would liek to know how can I quit the Looper on occurence of a specific condition
for example, when a counter reaches a specific limit.
In the below code, I want to call…

Amrmsmb
- 1
- 27
- 104
- 226
0
votes
0 answers
Handler in onresume causes sigbart error
I am using a handler onresume method which causes a sigbart error asking not to block ui threads. Here's the code I have:
@Override
public void onResume(){
super.onResume();
new Handler().postDelayed(() -> {
try…
user2386226
0
votes
0 answers
HandlerThread audio recorder doesn't start recording after which a message has been sent to its handler
I'm trying to write a sound recorder app. The whole app consists of two components: Main Activity which only contains a fragment called RecordFragment, and RecordThread class in charge of recording the audio.
RecordThread is extended from…

Soroush
- 93
- 1
- 9
0
votes
4 answers
How to Stop Handler thread?
I want to stop this thread on button click.
TIME_OUT = 45000;
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent i = new
Intent(MapsActivity.this,MapsActivity.class);
…

Ankesh Roy
- 278
- 2
- 8
- 33
0
votes
1 answer
download users profile pics from Facebook: AsyncTask or HandlerThread
I've a list of urls. Each url holds a differenct facebook user's profile pic.
I would like to download these pics and display them on the UI thread (on the screen).
I used new AsyncTask for each image and the images are displayed one by…

Maor Cohen
- 936
- 2
- 18
- 33
0
votes
0 answers
unable to set drawable on ImageView in HandlerThread subclass
i am writing a flickr client as part of a project from a book that i am reading. in it i create a subclass of HandlerThread that downloads images from flickr and then sets them in an ImageView. i set a placeholder .png earlier in the program and…

Mox_z
- 501
- 7
- 30
0
votes
2 answers
android Handler gives Null object reference error
My Process is Updated the ProgressBar in the UI thread by using Handler.but it gives an error like this.
.Handler.sendMessage(android.os.Message)' on a null object reference
Plese check my code
public class MainActivity extends…

sreeku24
- 320
- 3
- 5
- 16
0
votes
2 answers
Android DownloadFilesTask concept
While trying with client server (fetching mysql data) with help of a tutorial I get many errors. I just read some threads here and I understood that the biggest error I get
Error in http connectionandroid.os.NetworkOnMainThreadException
…

pia-sophie
- 505
- 4
- 21