| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 切换回主线程执行 |
| | | * |
| | | * @param runnable 回调 |
| | | */ |
| | | public static void runMainThread(Runnable runnable) { |
| | | try { |
| | | if (Looper.myLooper() == Looper.getMainLooper()) { |
| | | runnable.run(); |
| | | } else { |
| | | handler.post(runnable); |
| | | } |
| | | } catch (Exception ignored) { |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 子线程执行 |
| | |
| | | * @param context 上下文(不需要弹框填null) |
| | | * @param showErrorMode 是否显示错误(不需要填null) |
| | | */ |
| | | public static void runThread(Runnable runnable, Context context, ShowErrorMode showErrorMode) { |
| | | public static void runSubThread(Runnable runnable, Context context, ShowErrorMode showErrorMode) { |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |