![](https://img-blog.csdnimg.cn/20190927151101105.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
封装
对普遍性控件进行简单封装,创建自己的代码库
asahi_xin
这个作者很懒,什么都没留下…
展开
-
Android 动态获取权限
3.申请权限的fragment。4.在清单中配置权限。原创 2023-06-13 10:58:47 · 261 阅读 · 0 评论 -
CountDownTimer封装
public class CountDownTimerManager { /** * 总倒计时 */ private long millisInFuture = 0; /** * 回调时间 */ private long countDownInterval; /** * 倒计时完成回调 */ private FinishCountDown finishCountDown; /**原创 2022-02-17 15:10:32 · 1567 阅读 · 0 评论 -
Activity跳转封装
public class ActivityManager { /** * activity跳转不带参数 * * @param context 上下文 * @param cls 目标 */ public static void goActivity(Context context, Class<? extends Activity> cls) { startActivity(context, cls, nu原创 2021-08-11 14:42:48 · 297 阅读 · 0 评论 -
单例模式封装Activity管理类
public class AppManager { private Stack<Activity> activityStack; private AppManager() { activityStack = new Stack<>(); } public static AppManager getInstance() { return AppHolder.appManager; } private原创 2021-08-10 14:35:32 · 140 阅读 · 0 评论 -
Android 单例模式封装SharedPreferences
参考应用最广的模式-单例模式public class Preferences { private static Preferences singleton = null; /** * 文件名 */ private String FILL_NAME = "Preferences"; /** * 共享对象参数 */ private final SharedPreferences sp; /** * 构造原创 2021-03-14 12:49:15 · 264 阅读 · 2 评论 -
Android 单例模式封装Toast
参考应用最广的模式-单例模式封装public class ToastUtil { private Context context; private Toast mToast; /** * 私有化构造 */ private ToastUtil() { } public static ToastUtil getInstance() { return ToastUtilHelper.INGLETON; }原创 2021-03-12 15:11:58 · 664 阅读 · 0 评论 -
Android 单例模式封装Application
代码public class BaseApplication extends Application { private static BaseApplication baseApplication; public BaseApplication() { super(); baseApplication = this; } public static BaseApplication getInstance() { ret原创 2021-03-12 14:31:09 · 317 阅读 · 0 评论