android-looper Questions

5

We are seeing this ANR in different parts of our app. Wanted to understand what causes this ANR? main (native): tid=1 systid=31940 #00 pc 0x5431c libc.so #01 pc 0x1313a5 libart.so #02 pc 0x2ab05b...

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...

14

Solved

I am new to Android. I want to know what the Looper class does and also how to use it. I have read the Android Looper class documentation but I am unable to completely understand it. I have seen it...
Joettajoette asked 29/9, 2011 at 13:4

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

3

Solved

This bug baffled me for hours. I am getting the NullPointerException. The problem is this error is not consistent. It happens when I launch the app, but only occasionally. So I am not sure what is ...

4

Solved

TrendingViewModelTest @RunWith(JUnit4::class) class TrendingViewModelTest { private lateinit var trendingRepository: TrendingRepository private lateinit var trendingViewModel: TrendingViewModel...
Mcneal asked 23/9, 2019 at 7:46

1

I cannot make liveData.postValue working in while trying to make unit test. I have been checking in google for a solution and this is the code I have now. public class ProjectListViewModelTest { ...

2

Solved

I used to use FusedLocationApi until I learned that it is deprecated (see references below). It was simple to implement. As the documentation says you need to use it in conjunction with GoogleApiCl...
Cheree asked 3/10, 2017 at 19:34

1

Solved

I'm using WorkManager to sync data from my local Room database to server. The issue is that Room gives error to build database in Loop.MainLooper() and when i use it as following it works fine. But...
Jard asked 29/5, 2018 at 8: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

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

Just clarifying but in an Android activity on MAIN Thread if I call Looper.myLooper() vs Looper.getMainLooper() the return the same reference, right? they are the same thing? I know I would never h...
Philia asked 16/12, 2015 at 21:31

0

I am aware that the recommended way of doing background-like tasks in Android is to start a worker thread of some kind, but I'm wondering if there is a simpler alternative available when the backgr...
Agony asked 22/12, 2015 at 23:20

0

I have used some Handlers like new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { try{ Messages.onAcknowledgeReceived(); }catch(Exception e){ e.print...
Merrymaker asked 17/12, 2014 at 8:57

0

I'm having an issue in trying to run a PhoneStateListener on* callback methods in a backround thread. Here's what I did so far: First, I wrote my PhoneStateListener implementation. Something on th...

2

I am developing an android application and I am using a service that tracks location via GPS every 10 minutes. But when I put the location listener in a timer task, it throws an exception: Canno...
Diaphoresis asked 7/2, 2011 at 13:36
1

© 2022 - 2025 — McMap. All rights reserved.