![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Android
良砚
百鬼夜游,你在其中比鬼还开心
展开
-
android-控件刷新和加载
控件刷新和加载引入控件api ‘com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-21’刷新控制类public class PullRefreshBean { public int pageSize = 10; public int pageIndex = 1; public boolean isRefreshing = false; public boolean isLoadMoreing =原创 2021-03-31 13:54:16 · 495 阅读 · 1 评论 -
android-使用广播
使用广播注册并监听 // 监听退出(BaseActivity) onCreate(...){ ``` if (isObserveLogout()) { registerLogoutBoardcast(); // TODO: 2021/2/21 退出登录后的操作 } ``` } //注册注销广播 private void registerLogoutBoardcast() {原创 2021-03-31 13:52:58 · 72 阅读 · 0 评论 -
使用Eventbus
使用eventbus进行消息传递,可以处理较为复杂联动较多的信息处理引入方法:api ‘org.greenrobot:greendao:3.2.2’implementation ‘org.greenrobot:eventbus:3.0.0’随用随注册初始化 if (!EventBus.getDefault().isRegistered(this)) { EventBus.getDefault().register(this); }发送原创 2021-03-31 13:50:27 · 109 阅读 · 0 评论 -
清除已存在的 Fragment 防止因没有复用导致叠加显示
清除已存在的 Fragment 防止因没有复用导致叠加显示 /** * 清除所有已存在的 Fragment 防止因重建 Activity 时,前 Fragment 没有销毁和重新复用导致界面重复显示 * 如果有自己实现 Fragment 的复用,请复写此方法并不实现内容 */ public void clearAllFragmentExistBeforeCreate() { List<Fragment> fragments = getSupport原创 2021-03-31 13:45:51 · 363 阅读 · 0 评论 -
泛型判空处理
类泛型判空处理 //泛型空判断 Type types = this.getClass().getGenericSuperclass(); // generic 泛型 if (types instanceof ParameterizedType) { ParameterizedType type = (ParameterizedType) getClass().getGenericSuperclass(); Class cl原创 2021-03-31 13:44:29 · 723 阅读 · 0 评论