MonoDroid Looper.MyQueue() hangs on some activities / Idle Handler?-Collection of common programming errors

I’m using MonoDroid Looper.MyQueue().AddIdleHandler() to execute some Commands when the app is in idle mode. This is working in one activity, but if I’m starting the second activity it hangs until i touch the screen or restart the first activity. Theres no loop or anything which could block the queue in the second activity. How can i prevent the looper from hanging?

Looper.MyQueue().AddIdleHandler(new ExecuteRunner(appState));
public class ExecuteRunner : Java.Lang.Object, MessageQueue.IIdleHandler
{
    int count = 0;
    ApplicationState appState;
    public ExecuteRunner(ApplicationState pAppState)
    {
        appState = pAppState;
    }

    public bool QueueIdle()
    {
        appState.YooManager.Manager.ExecuteCommand();
        count++;
        Android.Util.Log.Debug("YooBik-Exe", count.ToString());
        return true;
    }
}

Could the message queue be blocked by something? In the activity where the idle handler isn’t working the OnTouch event is registered.

Or does anybody know another way how to implement an idle handler for monodroid?

  1. If it hangs until you touch screen I guess it waits on MessageQueue.next() ( line this.wait(); ). Because your main activity looper.loop() calls MessageQueue.next() and what it does : while(ture) { 1. pullNextLocked() and returns if there is some msg to execute. otherwise : 2. execute all queueIdle()’s. and then 3. this.wait();

Originally posted 2013-11-26 18:03:05.