Java Code Examples for android.os.Looper#prepareMainLooper()

The following examples show how to use android.os.Looper#prepareMainLooper() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Main.java    From hack-root with MIT License 6 votes vote down vote up
public static void main(String[] args) {
    Looper.prepareMainLooper();
    System.out.println("*****************hack server starting****************");
    new Thread(new Runnable() {
        @Override
        public void run() {
            new SocketService(new SocketService.SocketListener() {
                @Override
                public String onMessage(String msg) {
                    return resolveMsg(msg);
                }
            });
        }
    }).start();
    Looper.loop();
}
 
Example 2
Source File: SuServiceStarter.java    From rebootmenu with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("ConstantConditions")
private void hang() {
    Looper.prepareMainLooper();
    RMPowerActionService service = new RMPowerActionService(ActivityThread.systemMain().getSystemContext());
    ServiceManager.addService(XposedUtils.getServiceName(RMPowerActionService.TAG), service);
    service.allServicesInitialised();
    Looper.loop();
    throw new RuntimeException("Main thread loop unexpectedly exited");
}
 
Example 3
Source File: Reverser.java    From android-test with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
  Looper.prepareMainLooper();
  Reverser r = new Reverser();

  new Handler(Looper.myLooper()).post(new Register(r));
  Looper.myLooper().loop();
}
 
Example 4
Source File: ServerMain.java    From Fairy with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
    Looper.prepareMainLooper();
    new FairyServer("fairy_server").start();
    Looper.loop();
}