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
1
vote
0 answers

Why override method run() in subclass of HandlerThread doesn't execute completely?

I am new to Handler in Android, I wanna test Handler, so I use ThreadHandler and extends it, at the same time I override the method - run(), adding some log to indicate the start an end of the Looper. but when the test done, I just saw the start log…
Jack_Du
  • 105
  • 7
1
vote
2 answers

How to cancel Service/IntentService/AsyncTask/Looper

I'm going nuts here. I want a simple thing - I have a long task (fetching several data objects from the web) and I want the ability to cancel it. I tried a lot of things (a lot) and nothing works The flow goes like this: the user click on a…
Dror
  • 11
  • 1
  • 2
1
vote
0 answers

Can't create handler inside thread Thread[create_react{context,5,main] that has not called Looper.prepare();

I'm trying to initiate an SDK module that is built in Java using React Native. In this case, I have to bridge the module using the "ReactContextBaseJavaModule" library. Unfortunately, the module needed a context to initiate the SDK, so the class…
frankied003
  • 466
  • 6
  • 26
1
vote
4 answers

Android: requestLocationUpdates throws exception

I'm trying to get periodically the user position via GPS in Android and send the data to a remote DB, but I get the exception: Can't create handler inside thread that has not called Looper.prepare(). The method that retrieves the position is in a…
noloman
  • 11,411
  • 20
  • 82
  • 129
1
vote
3 answers

Android: cant create handler inside thread that has not called looper.prepare

I know this kind of question exist but I'm confused in this case. I'm using the following code: package com.example.GetALocation2; import com.example.GetALocation2.MyLocation.LocationResult; import android.app.Activity; import…
Emkey
  • 5,346
  • 8
  • 38
  • 55
1
vote
1 answer

Android: difference between getMainLooper() and Looper.myLooper()

I'm now trying to resurrect one project. There was an exception on getMainLooper()... I thought that may be there's a problem with MainLooper initialization and added Looper.prepareMainLoop() before that. Exception telling me that there's already a…
leshka
  • 1,764
  • 6
  • 32
  • 42
1
vote
1 answer

`Can't create handler...Looper.prepare()` in inherited Activity

I have a Game Activity (Activity A) that works well with all the code. Then I create a new Activity (Activity B) for my new game mode, that extends Activity A. However, when encounter the Toast line, Activity B suddenly thrown an exception (Activity…
Luke Vo
  • 17,859
  • 21
  • 105
  • 181
1
vote
1 answer

Android, honeycomb animation ("Animators may only be run on Looper threads") error

I had a previous project in which I could generically use the ObjectAnimator class to animate any class like this ObjectAnimator oa = ObjectAnimator.ofFloat(testShape, "translateX", 0f,…
Jon Rose
  • 1,457
  • 1
  • 15
  • 25
1
vote
2 answers

How to properly call AsyncTask from a separate thread?

I'm developing a game, that is running in a separate thread. Now I need to download an image from Internet. I've written an AsyncTask class for that, but I can't figure out how to properly call it from my game thread? In fact, my AsyncTask is…
Egor
  • 39,695
  • 10
  • 113
  • 130
1
vote
2 answers

Running CountDownTimer inside AsyncTask throws java.lang.RuntimeException - Looper.prepare()

I have a .lrc file and I need to go over every line with a CountDownTimer. I have tried using AsyncTask to do so but I get the error: Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() On…
Richard
  • 1,087
  • 18
  • 52
1
vote
1 answer

Create Handler in a class without get error "Looper not prepared"?

In my game, there is an game object class that need to use Handler to post a delay Runnable. However, everything I try to create an Handler in the object class, I receive error message: Can't create handler inside thread that has not called…
Luke Vo
  • 17,859
  • 21
  • 105
  • 181
1
vote
2 answers

Is this an example of redundant use of Handlers?

Is there any point in having multiple Handlers if they use the same Looper? eg: private Handler firstHandler = new Handler(Looper.getMainLooper()); private Handler secondHandler = new…
Nerdy Bunz
  • 6,040
  • 10
  • 41
  • 100
1
vote
1 answer

Sending messages from a different Handler to another handler's message queue

I want to send from another handler (not from the LooperThread mhandler itself) to the LooperThread 's message queue, but it does not show anything. The thread.sleep is to initiate the mHandler. Any ideas? Main Activity new…
Nick
  • 2,818
  • 5
  • 42
  • 60
1
vote
1 answer

Has alternative for looper.quitSafely() in below android api 17?

Is there a alternative way for looper.quitSafely() in below android API 17 ?
ali
  • 11
  • 1
1
vote
0 answers

W/Looper: Could not write wake signal, errno=89

When I use send message from a jni thread to this thread (ZWANJniThread) by "Input" method, At beginning, it works, but when I create a new ZWANJniThread thread, sometimes, I get "W/Looper: Could not write wake signal, errno=89" in log. Has any…
dong
  • 11
  • 1