Back to project page hackfmi-ragdoll-physics.
The source code is released under:
GNU General Public License
If you think the Android project hackfmi-ragdoll-physics listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.midtownmadness.bubblecombat.multiplay; /* ww w .java2s .c o m*/ import android.os.Handler; import android.os.Looper; public class LooperThread extends Thread { private Handler handler; private Runnable emptyMessage = new Runnable() { @Override public void run() { // do nothing // XXX prevent the Looper from getting out of messages and quitting // the loop // not very elegant, but will do the trick handler.postDelayed(this, 1000); } }; private Callback<Void> handlerReadyListener; public void run() { Looper.prepare(); handler = new Handler(); handler.post(emptyMessage); if (handlerReadyListener != null) { handlerReadyListener.call(null); } Looper.loop(); }; /** * Use this instead of constructor */ public void setHandlerReadyListener(Callback<Void> callback) { this.handlerReadyListener = callback; } public Handler getHandler() { return handler; } }