@Override protected void onDestroy() { haveDestroy = true; handler.destroy(); activityPool.removeSelf(); super.onDestroy(); }
/** * 吐出一个显示时间较短的提示 * * @param formatResId * @param args */ public void toastS(final int formatResId, final Object... args) { handler.post( new Runnable() { @Override public void run() { ToastUtils.toastS(getBaseContext(), getString(formatResId, args)); } }); }
/** * 吐出一个显示时间较短的提示 * * @param format * @param args */ public void toastS(final String format, final Object... args) { handler.post( new Runnable() { @Override public void run() { ToastUtils.toastS(getBaseContext(), String.format(format, args)); } }); }
/** * 吐出一个显示时间较短的提示 * * @param resId */ public void toastS(final int resId) { handler.post( new Runnable() { @Override public void run() { ToastUtils.toastS(getBaseContext(), resId); } }); }
/** * 吐出一个显示时间较短的提示 * * @param content */ public void toastS(final String content) { handler.post( new Runnable() { @Override public void run() { ToastUtils.toastS(getBaseContext(), content); } }); }
/** * 吐出一个显示时间较短的提示 * * @param view */ public void toastS(final View view) { handler.post( new Runnable() { @Override public void run() { ToastUtils.toastS(getBaseContext(), view); } }); }
/** * 弹出一个进度对话框 * * @param message 消息 */ public void showProgressDialog(final String message) { if (!haveDestroy) { handler.post( new Runnable() { @SuppressWarnings("deprecation") @Override public void run() { Bundle bundle = new Bundle(); bundle.putString(KEY_DIALOG_MESSAGE, message); showDialog(DIALOG_PROGRESS, bundle); } }); } }
/** * 弹出一个消息对话框 * * @param message 消息 * @param confrimButtonName 确定按钮的名字 */ public void showMessageDialog(final String message, final String confrimButtonName) { if (!haveDestroy) { handler.post( new Runnable() { @SuppressWarnings("deprecation") @Override public void run() { Bundle bundle = new Bundle(); bundle.putString(KEY_DIALOG_MESSAGE, message); bundle.putString(KEY_DIALOG_CONFRIM_BUTTON_NAME, confrimButtonName); showDialog(DIALOG_MESSAGE, bundle); } }); } }
/** 关闭进度对话框 */ public void closeProgressDialog() { if (!haveDestroy) { handler.post( new Runnable() { @SuppressWarnings("deprecation") @Override public void run() { try { dismissDialog(DIALOG_PROGRESS); } catch (Throwable throwable) { throwable.printStackTrace(); } } }); } }