Questions tagged [looper]

A JQuery plugin for carousel. No coding required.

It is a JQuery carousel plugin to cycle through content with minimal coding. It has minimal transition effects and uses JQuery's animate function. Keyboard navigation is also available.

190 questions
2
votes
2 answers

Android - Code After Looper

I have a child thread running to do a task infinitely. I want to (1) constantly send data back to the UI thread, and (2) occasionally send data (corresponding to buttons) to the child thread to pause/continue the infinite task. My problem is that…
Andy
  • 21
  • 2
2
votes
1 answer

Android app crashing (looper = null)

I have a problem with my app. My application is actually a service. I have Main extends Service, it has private Looper looper variable to get HandlerThread looper. In onCreate function I initialize location manager, location listener and…
Ziker
  • 141
  • 4
  • 20
2
votes
2 answers

Does android.os.Looper drain battery?

I guess, this is a silly question, but still... In my app I need to run heavyweight tasks in sequence (in a separate thread of course). So, I think, that Looper is my choice for this. AsyncTask is not the case, because requests can arrive at any…
UnknownJoe
  • 599
  • 5
  • 14
  • 30
2
votes
1 answer

Android: Looper vs AlarmManager

Which one is best for continuous/time-wise server updates. Some developers use AlarmManager followed by PendingIntent and some also use Looper with Handler. So can anyone please explain me that which is best for continuous network updates and why.
Ranjit
  • 5,130
  • 3
  • 30
  • 66
2
votes
2 answers

What causes Looper.Loop() to hang (i.e. never return)

I'm a little confused about something. Basically, I'm spawning a thread, and in addition I want to run a message loop in that thread. I'm basically doing the following: This is straight out of the Android Looper class API documentation. However, my…
Andi Jay
  • 5,882
  • 13
  • 51
  • 61
2
votes
1 answer

How to correctly use the HandlerThread with a socket?

I've been looking at the HandlerThread class as originally I was using a simple thread and handler, but came a cropper with the NetworkOnMainThreadException in android. I can't seem to understand how I would be able to introduce things like sockets…
NiffyDroid
  • 231
  • 2
  • 10
2
votes
1 answer

Android LocationListener: is removeUpdates necessary?

When developing a location-aware Android application using a LocationListener, is it obligatory to call LocationManager.removeUpdates() before the application finishes? Or more generally, is it obligatory to call LocationManager.removeUpdates()…
bryn
  • 51
  • 1
2
votes
1 answer

Android: LocationManager constructor's looper

There is the possibility to start retrieving notifications from a LocationManager with the following method: requestLocationUpdates(String provider, long minTime, float minDistance, LocationListener listener, Looper looper) Documentation explains…
Massimo
  • 3,436
  • 4
  • 40
  • 68
2
votes
3 answers

Why do I need a Looper in my AsyncTask?

I want to use AsyncTask for update my db4o with a server. In the doInBackground method , I connect to the server, update the db4o, and schedule a pendingintents. Not modify UI or show any toast. Initially, I had the following error: Can't create…
Héctor Ortiz
  • 257
  • 1
  • 6
  • 17
2
votes
1 answer

Thread Inside Broadcast Receiver Android

I am getting a DownloadManager.ACTION_DOWNLOAD_COMPLETE broadcast upon getting I am required to extract the zip file and fill the the data base I have written the code to do my work .But I have to start the Thread here to handle the file extraction…
Vipin Sahu
  • 1,441
  • 1
  • 18
  • 29
2
votes
1 answer

The behavior between ui-threads messagequeue, looper and the handler class

I post this question because i wanna know if my thoughts are right about the basics. What should be clear is that the UI-Thread contains a MessageQueue, which is associated with a Looper to get messages/runnables out of the queue for processing. …
Steve Benett
  • 12,843
  • 7
  • 59
  • 79
2
votes
0 answers

Force flushing MessageQueue of UiThread android

I want to flush content to the display as soon as possible but my setup code which is want to have on the UI Thread is taking too long. There is nothing rendered on the screen until everything is done. So if i do a View.postDelayed(Runnable, long)…
1
vote
2 answers

Does an Android Looper thread use processing power?

This question would probably also apply to the general world of Java threads... I have a thread that I use like so (this is in the run method): Looper.prepare(); Handler rHandler = new Handler(){ @Override public void handleMessage(Message…
yydl
  • 24,284
  • 16
  • 65
  • 104
1
vote
1 answer

Only one Looper may be created per thread Error, Async Task

The code at the bottom of this post is triggered by the following line of code. new MasterClickAsyncTask(main).execute(position); The doInBackground portion of code below calls a method containing a for loop, hence the need for…
Ben Pearce
  • 6,884
  • 18
  • 70
  • 127
1
vote
1 answer

TimerTask, Geolocation and Looper

I need to perform the follow logic in my application: Every minute, I want to be able to listen to GPS location for 20 seconds to get a GEO-location fix. This obviously needs to run a different thread than the UI thread. I am however having some…
Gal
  • 5,338
  • 5
  • 33
  • 55