Questions tagged [android-thread]

147 questions
-1
votes
1 answer

Set a timer for Fused Location provider onLocationChanged

I am using FusedLocationClient for the location. I have noticed that some times it takes too much time for onLocationChanged() to get called because of whatever issues. Is there any good way that i can put a timer on that, for example if i don't get…
-1
votes
1 answer

I want to show gif image show on screen even when app is closed

With a mouse click, you implement two things: Sound is playing The GIF image is showing I'm trying to show the GIF on the screen even when I close the app I'm using the services but because the sound keeps playing while the GIF image appears, I…
-1
votes
1 answer

Android: Unable to update custom notification when I kill my app

I am downloading multiple files one after the other in service. I want to update download progress in notification. But my notification doesn't update when I kill my app. Download works on different thread. Download works fine in when app is…
-1
votes
2 answers

Android Access Same instance method on activity from different threads without locking. Added synchronized method

I have a method goToNextScreen() which does a check for 3 different asynchronous process, so when all process are done the validation will changes activity (Is kind of a Splash activity) My example code access from 3 different result callbacks to…
Xaren
  • 491
  • 1
  • 4
  • 15
-1
votes
3 answers

How to run code every second with thread in Android

In my application, I want to run code every 120second and to achieve this I am using Thread. Following is the code snippet that I am using, but it is giving me Force close error. Show me error for this line : getActivity().runOnUiThread(new…
-1
votes
3 answers

AsyncTask is using the same thread and queueing all my requests

In my Android app, I figured out that all my api calls are being queued instead of happening concurrently. I'm assuming they are all being posted to the same thread, while I was under the impression that an AsyncTask creates a new thread for…
Chase Roberts
  • 9,082
  • 13
  • 73
  • 131
-1
votes
2 answers

how to send continous streams from a separate thread to activity

I have started a thread which connected to bluetooth device and streams data. I actually started this thread from a service(Thread not started from activity). So know I need to communicate to activity to show the list of input streams. I am not sure…
-2
votes
2 answers

How to cancle AsyncTask in Android

In my application i have 2 AsyncTask methods and i want when activity go to onPause cancel this AsyncTasks and in onResume start from the beginning. I write below codes, i pressed home button and application go to onPause and open again this app…
Hesika
  • 1
  • 4
-2
votes
3 answers

How to play song after X seconds from starting an activity

I'm creating an android application, i need a way to run song after some seconds from starting activity, by default the song starts directly after i open that activity. thank you for your help
-2
votes
1 answer

Two Thread.sleep() in the same android Activity

Maybe someone can tell me what I'm doing wrong I'm writing an Android app that will show 3 views separates by a time interval so the basic idea is; ViewOne.setVisibility(View.INVISIBLE); //This is redundant but I put here for clarity …
-2
votes
1 answer

Android App Crashes When Thread Is Interupted

I have a thread running in my app but when it finishes its workand i try and stop it the thread crashes the app and restarts leading to a loop of crashes till i reopen the app The Runnable: final class TheThread implements Runnable{ public void…
-2
votes
1 answer

How to fix java.lang.IllegalThreadStateException?

In my application i want use one thread into CountDownTimer and for this i write below code. But when run application after a few seconds show me error in LogCat. My codes: @Override public View onCreateView(LayoutInflater inflater,…
fghj
  • 11
  • 1
  • 2
1 2 3
9
10