89 questions
0
votes
0
answers
72
views
LiveData is getting empty or null value in one case and correct value in other case. Can't get the reason of this behavior
I am trying to fetch "name" field from my firestore database, with two different processes. In both process, I am using a helper class to fetch data as Flow<List<String>> and ...
1
vote
0
answers
192
views
How to overcome ANRs issue even though i run the background task in GlobalScope.launch(Dispatchers.Main)
The app is prompted with an "App is not responding" window.
In my main activity, inside the button click, I am calling "Background task" Meanwhile I am shown a progress bar in the ...
1
vote
2
answers
174
views
Call a synchronized method with a new thread in a synchronized method
We have a task to perform, dummyMethod.
private synchronized void dummyMethod(){
Log.d("debug", "do nothing in dummyMethod()")
}
We run that task several times.
private ...
-1
votes
1
answer
58
views
Understand Threading in Android(Update UI from another thread)
I was trying to understand the threading in android. As we know, we can't update a view from background thread. I was trying to understand with different cases and came across a case below. When I ...
1
vote
0
answers
23
views
How to stop all native threads when Android app is backgrounded?
My video game is based on NativeActivity and has a lot of C++ threads. I'd like all those threads to pause like they do on iOS when my app is backgrounded. There are simply too many threads to chase ...
0
votes
2
answers
228
views
Thread.sleep on main thread causing view changes to be skipped?
I'm trying to add a red flash to my application when some event occurs.
Using the windowManager, i've created and added a simple view that just fills the canvas with red, and initializes the opacity ...
1
vote
1
answer
240
views
How to communicate with a worker viewmodel in Martin's Clean Architecture
In my application I have a socket UDP server which listens to broadcast messages and notifies the UI about the message with an interface to update the recyclerview to add the message.
I used to use a ...
0
votes
1
answer
65
views
How would a previously started Thread within a Service be stopped if said Service is killed by the system and later restarted?
If a Service implements a thread, it would hold the reference to it using a class field, so that it could later stop the thread by calling the proper methods (e.g. quit() or quitSafely() in the case ...
0
votes
0
answers
294
views
Have race condition saving items into a Room database
I am trying to save the following dao object into a Room database -->
data class JobPW(
@Embedded val job: Job,
@Relation(
parentColumn = "job_id",
entityColumn = &...
1
vote
0
answers
2k
views
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::...
1
vote
1
answer
118
views
How does Object.notify() work with Object.wait()?
I am trying to track a resource which behaves in an asymmetric manner. That is, it responds immediately to a start() request, but finishes processing a cancel() request at a significant delay.
For ...
1
vote
0
answers
183
views
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) at
android.database....
0
votes
1
answer
415
views
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 ...
4
votes
1
answer
2k
views
Kotlin - Achieving Executors.newSingleThreadExecutor behaviour using coroutines
Executors.newSingleThreadExecutor queues the tasks registered to it and then executes them sequentially. The following code:
val singleThreadedExecutor = Executors.newSingleThreadExecutor()
(0..10)....
0
votes
0
answers
40
views
kotlin, how to run sequential background threads [duplicate]
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 ...