下面列出了android.os.Looper#prepareMainLooper ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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();
}
@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");
}
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();
}
public static void main(String[] args) {
Looper.prepareMainLooper();
new FairyServer("fairy_server").start();
Looper.loop();
}