Questions tagged [android-threading]

Android Multi-threading is the ability of an Android app to perform work concurrently or asynchronously by utilizing multiple concurrent streams of execution (generally referred to as threads).

90 questions
1
vote
0 answers

Random SQLiteDatabaseLockedException

I am receiving this crash in firebase: Fatal Exception: android.database.sqlite.SQLiteDatabaseLockedException: database is locked (Sqlite code 5), (OS error - 11:Try again) …
Verona1024
  • 11
  • 1
1
vote
2 answers

Waiting for a Worker to finish

I have a moderately long-running (a minute or two) background process, which I'm running as a Worker using WorkManager. There are two places from where it can be started - either from the UI, or from another background process. In the case of the…
SatNav
  • 33
  • 6
1
vote
1 answer

Problem in Uart callback in Android Things Uart

I am using Odroid N2+ board for transmitting and receiving data from UART and turning GPIO ON and OFF. The GPIO part is working alright. When I put the code for transmitting only, there was no problem. But when I put code to receive , the app…
sujan_014
  • 516
  • 2
  • 8
  • 22
1
vote
1 answer

Choreographer: Skipped frames : The application may be doing too much work on its main thread

In my android application I am getting "The application may be doing too much work on its main thread" as warning and api call taking to much time to make response.I showed it with an example.I have a radio button with 2 cases each will make an api…
KJEjava48
  • 1,967
  • 7
  • 40
  • 69
1
vote
0 answers

What causes ANR's with no long tasks on main thread?

Our game app has a few remaining ANRs that don't fall into the obvious "doing something heavy on the main thread" scenario, but it's still stopping the main thread servicing the input events. Input dispatching timed out (Waiting to send non-key…
1
vote
1 answer

show download progress bar

In my app I'm using executor service to download a file from url. Now I want to add a horizontal progress bar to show the download progress. but I face errors. how can I add a progress bar in this code, without using async task? private class…
1
vote
3 answers

How to pass a value from a runnable thread once it has finished in Android Studio?

I am using a thread to get an id from my database. Once the thread has finished running I need to use that id in another thread to get a list of items. Once that thread has finished I use the list of items to populate a spinner. The problem I am…
1
vote
1 answer

Is every function that is called inside launch(Dispatchers.IO) also called in the IO Dispatcher?

Currently, I am trying to optimize my app performance by improving the usage of different Dispatchers and contexts. One question I stumbled upon is that If I launch a suspend function inside a coroutine with a IO Dispatcher, will every other…
Andrew
  • 4,264
  • 1
  • 21
  • 65
1
vote
0 answers

Android Service not notifying it has started and UI Locking Intermittently

I get the issue intermittently, It seems when the UI locks the Service notification has NOT popped up, however the service is running. I assume it is a thread issue locking I have managed to grab a small portion of the crash, but will have to wait…
user15348067
  • 43
  • 1
  • 5
1
vote
1 answer

Can a background thread exist without the main thread?

If I remove the app from the background/recent app list, the UI thread also stops so that system can reclaim the memory associated with the UI. Now consider a case where a PeriodicWorkRequest is triggered which in turn starts a worker (after the app…
Parth Kapoor
  • 1,494
  • 12
  • 23
1
vote
2 answers

Using Kotlin Coroutines to update my TextView crashes it:

I am a big newbie when it comes to Kotlin programming. I have basic understanding of Threading. Here's the thing: I am trying to update my TextView (inside a fragment) once every second after clicking a button. I set the button's onClick function to…
yuroyami
  • 814
  • 6
  • 24
1
vote
1 answer

Can adding anonymous runnables in the queue of a Handler thread cause a memory leak?

Will this code cause a memory leak if it is present in the Activity VS ViewModel component? handlerThread = new HandlerThread("myHandlerThread"); handlerThread.start(); Handler handler = new Handler(handlerThread.getLooper()); …
1
vote
0 answers

Android app freezes while WebView inflating

In my app I have some fragments and I switch between them with this nice animation: activity?.supportFragmentManager?.beginTransaction() ?.setCustomAnimations( R.anim.slide_in_from_right, …
1
vote
0 answers

Android - Choosing a method to run in a thread

I'm creating an Android app that communicates with a webservice. I have a SOAP class that holds different methods which execute web service functions and a SOAPCaller class that runs a thread to call the methods within the SOAP class. To choose…
Paul Alexander
  • 2,686
  • 4
  • 33
  • 69
1
vote
2 answers

Progress bar.setProgress(variable) in a background thread

this is my first question on stack (great community, thanks!) So, I have this problem: I'm developing an android application with a tab layout. Whenever I navigate to the "Status" tab, I'd like to show a circular ProgressBar that is updated…
tip
  • 11
  • 3