标签:null oid private ogg oop ble eth read art
后台开启线程的函数写法:
更加简洁明了:
public class BackTaskRunner { private static final String TAG = "BackTaskRunner"; private HandlerThread handlerThread; private Handler handler; private BackTaskRunner() { handlerThread = new HandlerThread(TAG); handlerThread.start(); handler = new Handler(handlerThread.getLooper()); } public static Handler getHandler() { return SingletonHolder.sRunner.handler; } private static class SingletonHolder { static BackTaskRunner sRunner = new BackTaskRunner(); } }
调用方法:
BackTaskRunner.getHandler().post(new Runnable() { @Override public void run() { Logging.d(TAG, "pay() start UNPay"); //最后一个参数: "01" 代表测试环境 "00" 代表正式环境 UPPayAssistEx.startPay(activity,null,null,tn,payMode); } });
标签:null oid private ogg oop ble eth read art
原文地址:http://www.cnblogs.com/NeilZhang/p/7078930.html