Issue Background I’ve found some classes/functions on a large app I work on, that have calls that shouldn’t be on the UI thread (such as accessing the storage or DB). Such operations could cause ANRs, and indeed I can see
Continue readingTag: multithreading
Constantly check if a value is present in the firestore
Issue I’m developing a piece of code for my application that can constantly check if a certain number exists on the firebase firestore. If nothing happens, instead if it does not exist it changes the screen. I accomplished this by
Continue readingOkhttp response callbacks on the main thread
Issue I have created a helper class to handle all of my http calls in my app. It is a simple singleton wrapper for okhttp that looks like this (I have omitted some unimportant parts): public class HttpUtil { private
Continue readingHow can I find when Android Java thread finishes its task?
Issue I have start a thread in my Android Apllication – in Java like bellow new Thread(new Runnable() { @Override public void run() { for (int i = 0; i < 10; i++) { try { Log.d(TAG, "startThread: " +
Continue readingHow can i make my request run in background while filling other EditTexts (Thread)?
Issue I’m new to threading but I have an EditText view which whenever is getting out of focused it fills a RecyclerView with image logos using the user’s input from EditText. But, whenever the user gets out of focuse and
Continue readingdoes coroutines in Kotlin work like threads?
Issue So I am trying to learn kotlin coroutines for networking purposes on Android but I don’t understand how they work. What am I missing in the code to make it work like a thread (the two counters should mix
Continue readingHow to send variable between classes while multithreading
Issue This a much simplified version of my multithreading project and its just a way to replicate the issue in a simpler way for easy understanding. So I have two classes startSession.java and main.java what I am trying to do
Continue readingHow to check if current thread is not main thread
Issue I need to check if the thread running a certain piece of code is the main (UI) thread or not. How can I achieve this? Solution Looper.myLooper() == Looper.getMainLooper() if this returns true, then you’re on the UI thread!
Continue readingHow to make JUnit4 "Wait" for asynchronous job to finish before running tests
Issue I am trying to write a test for my android app that communicates with a cloud service. Theoretically the flow for the test is supposed to be this: Send request to the server in a worker thread Wait for
Continue readingHow to send data from one future task to another future task in flutter?
Issue For example there are 4 Future tasks in flutter that are dependent on each other and after these tasks are completed Navigator.pushReplacement is called to change function. By dependent it means that return value of one Future is the
Continue reading