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
0
votes
1 answer

AsynchTask:Only one Looper may be created per thread

My app crashing on every 4-5th call. It's showing me following exception. 10-14 14:00:30.651: E/AndroidRuntime(25035): FATAL EXCEPTION: AsyncTask #1 10-14 14:00:30.651: E/AndroidRuntime(25035): java.lang.RuntimeException: An error occured while…
Sandip Armal Patil
  • 6,241
  • 21
  • 93
  • 160
0
votes
3 answers

Why complains my code has not called Looper.prepare()

I created a Looper thread class: public class MyLooperThread extends Thread{ private Handler mHandler; public void init(){ start(); //start the thread synchronized (this) { wait(5000); //wait for run() …
Mellon
  • 37,586
  • 78
  • 186
  • 264
0
votes
1 answer

Difference between looper and a service

I have read that a service is different from thread because it is not affected by the current activity. But threads are. But Looper is also same like a service which doesn't get affected by the current activity and they both run in background. So…
Neha Gupta
  • 847
  • 1
  • 8
  • 15
0
votes
1 answer

Threading - Can't create handler inside thread that has not called Looper.prepare()

I am using some older code and in running this method, I get the Looper.prepare() error. I don't understand what the line means but it is very necessary. Overall program: I have an AsyncTask that calls a method which calls doBindService()--from…
benzabill
  • 259
  • 1
  • 8
  • 21
0
votes
0 answers

AsyncTask and Looper.prepare() crash on every 6th call

i have an issue with looper.prepare() in doInBackground(). if i donot use looper.prepare it generates an exception "Can't create handler inside thread that has not called Looper.prepare()" and when i use looper.prepare it works fine for 5 calls to…
0
votes
1 answer

Toggling location updates from intentservice

I have code which is checking the database if the user wants to have the GPS running. I need to run through this every couples of minutes can I am using a Intentservice to run run the method. I've tried implementing Looper but that ends up with the…
TheHamstring
  • 712
  • 2
  • 6
  • 22
0
votes
1 answer

Passing a handler from a background Handler Thread, to background thread

Can anyone point me in the right direction here please ? I have an activity which spawns two threads, a thread for handling messages, using a Looper public static class MiddleThread extends Handler{ static public Handler handler; …
Douglas Brett
  • 171
  • 3
  • 8
0
votes
1 answer

HandlerThread needs to post to own queue

I have a MyThread extending HandlerThread, and I need to post runnables to its queue within the MyThread class. The only way I know how to do this is by calling h = new MyHandler(Looper.myLooper()); and thenh.post(r) to post the Runnable r. But…
sundie
  • 245
  • 3
  • 12
0
votes
2 answers

LocationListener onLocationChanged is not always called in DashClock extension

I have a DashClock extension that can be refreshed by clicking on it or by time interval so I'm using an AsyncTask. I also use a LocationListener since I need the user's location. Sometimes, onLocationChanged does not trigger causing my extension to…
0
votes
1 answer

Can code execution can be interrupted by main event loop?

I am talking about one thread. For example I have an Activity ui and following methods in it: /* TOP LEVEL OF EXECUTION LOOPER NOW WORKING */ class MyActivity extends Activity { void onCreate(Bundle instance) { super.onCreate(instance); …
0
votes
1 answer

Android: execute pending event immediately?

I have a spinner that filters an adapter in OnItemSelected. Like this: @Override public void onItemSelected(AdapterView av, View v, int position, long id) { switch (av.getId()) { case R.id.spfilteroptions: …
cdbeelala89
  • 2,066
  • 3
  • 28
  • 39
0
votes
2 answers

Android Gingerbread: Can't create handler inside thread that has not called Looper.prepare()

I have a code like this: final Context context = this; Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { new CheckMessageTask(context).execute(); //ERROR } }, 2500, 10 * 60 * 1000);…
Enes Sadık Özbek
  • 993
  • 10
  • 17
0
votes
1 answer

java.lang.RuntimeException: Issue with Looper.prepare()

I am making use of AsyncTask in my app and the code is, protected Void doInBackground(Void... params) { // Get the current thread's token try { synchronized (this) { Looper.prepare(); …
Mahe
  • 2,707
  • 13
  • 50
  • 69
0
votes
1 answer

Android worker thread with its own Handler/Looper

I want to have a worker thread that can 1) send messages to the UI thread to change things in the GUI, and 2) receive messages from the UI thread to control the worker thread's behavior. The first part is easy: Create a Handler in the UI thread and…
AndroidNewbie
  • 515
  • 5
  • 17
0
votes
2 answers

Android method that shows ProgressDialog, runs worker and waits for worker finish

I need to write static method that shows ProgressDialog, runs worker in thread and after worker finished ProgreesDialog must dismiss and my method return what worker did. This is my code: public static TOut execute(final Context c, final String…
hevy
  • 91
  • 1
  • 8