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).
Questions tagged [android-threading]
90 questions
0
votes
0 answers
PytestUnhandledThreadExceptionWarning during uiautomator dump
In my pytest I am actually not doing much just making uiautomator dump and pull the created file to local path, but it does give me the below warning:
copporcomm_test/access_try.py::test_unconfig_deamon_is_running_android
…

FotisK
- 1,055
- 2
- 13
- 28
0
votes
0 answers
Fatal Python error: (pygame parachute) Segmentation Fault Error
i have been wotkin in this but when I run the code it does not work and and keep getting this error.
I dont know what wrong in the code thank you!
### Server
import socket
from threading import *
import socket
import pygame
import pygame.camera
from…

Denzel
- 11
- 3
0
votes
0 answers
How to execute one thread after the other in a sequential manner to store data in Room
I am currently trying to add a few records into my local room DB in a sequential manner.
But It seems every time I execute a runnable on a single thread using Executor. It still returns data in random order.
Method Call
for (int i = 0; i <…

Sahil
- 69
- 8
0
votes
1 answer
Android Handler With custom toast is working weird
I'm struggling to solve this problem when i use a custom toast message with Handler(Looper.getMainLooper()).post { message } to show it on screen. but It didn't work what i expected. In my case, i must use the combination.
(but I know if i don't…

CodingBruceLee
- 657
- 1
- 5
- 19
0
votes
0 answers
kotlin, how to run sequential background threads
I want to run a function in a background thread with Dispatcher.IO on
recycleView code like this
class FileAdapter(val isFromNetwork : Boolean, val context: Context, val tools: Tools, val coroutineScope:…

HT__
- 11
- 2
0
votes
1 answer
How to use actors to handle message frequently in a single thread?
I need to launch some code frequently in a single non-UI thread. I am trying to use actors to achieve it:
class SomeClass {
@OptIn(ObsoleteCoroutinesApi::class)
private fun CoroutineScope.myActor() = actor {
for (message…

BArtWell
- 4,176
- 10
- 63
- 106
0
votes
0 answers
Can app support two intent activity simultaneously using coroutine scope
I have an app that accepts two intent requests (external intent request) with coroutine. For the main activity, I have written the code as below.
class MainActivity : Activity(), myClassInterface {
lateinit var activityContext: ActivityContext
var…

Kalai Selvi
- 157
- 11
0
votes
1 answer
What's the best method for periodic tasks (a watcher thread)?
I need to execute periodic http requests. I use volley for the requests, but I don't want to overflow the queue.
Right now I've got a thread that enqueues the request and waits for 3 seconds.
AtomicBoolean quitUsersWatcher = new…

Shout
- 338
- 5
- 14
0
votes
2 answers
Android Room - Cannot access database on the main thread
I'm getting the "Cannot access database on the main thread since it may potentially lock the UI for a long period of time." error, but from what I understand I'm launching a new coroutine to insert the data to the database. What am I doing…

Kuba Szczukin
- 7
- 3
0
votes
0 answers
Android ContentProvider receiving end: Threading necessity or not?
When I extend ContentProvider and implement the call() API:
public Bundle call (String authority,
String method,
String arg,
Bundle extras)
If I do a long-running process in for instance the call()…

JohnyTex
- 3,323
- 5
- 29
- 52
0
votes
0 answers
Content Provider - Usage
I have never worked on content providers. so, I have a basic definition kind of knowledge about it.
All I know about them is,
Content Providers manages access to a structured set of data. and, it encapsulates the data and provides mechanisms for…

Dhara Vamja
- 554
- 4
- 17
0
votes
1 answer
poolsize for ScheduledThreadPoolExecutor running in foregroundservice
In my foreground service, I need to connect to my backend to download the latest data once every 3 minutes and display the data on a notification. After a few minutes of googling, it seems using 'ScheduledThreadPoolExecutor' would be the best. But…

imin
- 4,504
- 13
- 56
- 103
0
votes
1 answer
Threading rules for an AsyncTask to work properly, Rule 1 and Rule 5?
I tried to go through the documentation the android provides about AsyncTask, even though it's a bit too much to comprehend, but what I came across is Threading rules for AsyncTask to work properly.
I paste the link here;…

mockingbird
- 53
- 6
0
votes
1 answer
Polling in android when only app is not minimized
Lets say I have a method printCount() that print values every second, I want the polling to stop when the android app is minimized. For an example if it was minimized at count = 15 and if I open it after 5 mins, It should resume the polling and…

Sandeepa
- 3,457
- 5
- 25
- 41
0
votes
1 answer
How to load thousands of records from local database to recyclerview without blocking UI using ROOM library
I am using local database to load records on recyclerview the problem is the size of records its about six thousand and when I click to open or show those records in recyclerview my device stuck for a few seconds a blank screen appear and when few…

Ali
- 27
- 4