846 questions
0
votes
0
answers
253
views
"Sending message to a Handler on a dead thread" warnings in a foreground service that gets location every second
I’m having an issue with a foreground service in my Android app. I’m encountering the following warning in the log:
Handler (com.google.android.gms.internal.common.zzi) {c19f288} sending
message to a ...
0
votes
0
answers
732
views
Handler should be static to prevent leaks and default constructor is deprecated confusion
I have a Handler in my MainActivity that receives messages from a Service.
class IncomingHandler extends Handler {
@Override
public void handleMessage(Message msg) {
super....
1
vote
1
answer
90
views
How do I send multiple key/values in a Message for Handler?
Message msg = Message.obtain();
msg.obj = "first string value";
msg.setTarget(mClientMessenger);
msg.sendToTarget();
I would like msg.obj to hold two key/value pairs if possible.
Ex:
key1, &...
3
votes
1
answer
73
views
Android Handler: how to change delay of a scheduled Runnable?
The following code schedules a Runnable for immediate execution if this Runnable is already scheduled:
public void onSomeEvent() {
if (handler.hasCallbacks(runnable)) {
handler....
0
votes
0
answers
34
views
Handler should be static or leaks may occur
I have the following handler called by a Thread ..
private class setupHandler extends Handler {
@Override
public void handleMessage(Message msg) {
((TextView) findViewById(R.id....
1
vote
1
answer
37
views
recyclerview is not initialized when the activity is reloaded
I'm new to android application development and I appreceiate some help.
there is a recycler view in my activity which is initialized in a handler which notifies the activity about the bluetooth ...
0
votes
1
answer
45
views
Android deep code communication with user via AlertDialog
In Android game (written in Java) I have an activity that's calling service and service calls a manager that checks certain values.
Activity code looks something like this:
public void performACheck() ...
5
votes
0
answers
1k
views
Native method - android.os.MessageQueue.nativePollOnce
I have many ANR on Goole Play Console. While, the stack trace does not show any useful information. There are some snapshots of the problem.
Native method - android.os.MessageQueue.nativePollOnce
...
1
vote
1
answer
35
views
Manage handler execution in multiple instance of activity running
I have been running a activity with mode = singleInstance in my app. In this activity onStart() method i am initializing a handler like this
Handler handler;
@Override
protected void onStart() { // ...
0
votes
1
answer
72
views
Issue in rendering items in the main thread from a worker thread
I have created a counter app that counts from 0 to infinity until the loop is stopped using a stop button. The app contains 2 buttons(start and stop) and 1 textview.
I aim to display the values from 0 ...
0
votes
1
answer
137
views
Android not getting response from handler
I am developing an app to communicate with wifi and android and I am able to send but not able to receive any response because my response is not being called.
So, the basic gist is that I am able to ...
-1
votes
1
answer
246
views
What to pass in as type handler for Bluetooth class for data transfer?
I am working on an Android app to communicate wirelessly with an Arduino over Bluetooth with an HC-05. I have been following the Transfer Bluetooth data documentation from Android. The following code ...
1
vote
1
answer
3k
views
Android, Kotlin: Handler.post vs coroutines
I use Handler(Looper.getMainLooper()).post(runnable) which places the query on the end of the thread queue instead of running it immediately. Is it ok to use this with kotlin, or is it better to use ...
1
vote
2
answers
1k
views
How to Implement or Handle the CountDownTimer using Kotlin Coroutines
I build an android app Countdown Timer using Kotlin. When I start the timer using Coroutines it throws an error as follows.
Need your help that:
How I can handle or implement the Countdown Timer's ...
0
votes
1
answer
751
views
Kotlin unable to stop handler running
I am running a handler that updates a textView element. The handler is started and stopped at the click of a button but once I start it, I cannot stop it.
fun updateTextView(handler: Handler, run: ...