摘要: 1 while ( 2 (ch = getchar()) 3 != '\n') { 4 if (!isalpha(ch)) { 5 putchar(ch); 6 } else { 7 putchar(ch + 1); 8 } 9 } 10 while ((ch = getchar()) != '\n 阅读全文
posted @ 2021-09-14 12:24 Anny0920 阅读(38) 评论(0) 推荐(0) 编辑
摘要: UI线程处理耗时操作会导致ANR,UI线程阻塞 访问磁盘、图片解码、网络请求,,,在工作线程中做,,,单独的后台进程? 后台处理机制:Services,线程、线程池、WorkManager Service和线程的区别: 线程是程序运行的最小单元,一个进程开启很多线程,,可以进行异步操作,在UI主线程 阅读全文
posted @ 2020-06-01 10:21 Anny0920 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 用https://www.wanandroid.com/网站提供的api 1、retrofit GET请求 public interface WanAndroidApi { //总数据 @GET("project/tree/json") //https://www.wanandroid.com/pr 阅读全文
posted @ 2020-05-30 10:40 Anny0920 阅读(519) 评论(0) 推荐(0) 编辑
摘要: 单例模式--线程安全的单例,懒汉式、饿汉,枚举等 享元设计模式:Message--obtain,,String public static void main(String[] args) { String s1 = "hello"; String s2 = new String("hello"); 阅读全文
posted @ 2020-05-30 09:33 Anny0920 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 1、new Module mylibrary,编译时需要在app的build.gradle中配置: implementation project(':mylibrary'), //mylibrary的build.gradle中implementation的内容 2、出现以下错误 FAILURE: B 阅读全文
posted @ 2020-05-14 11:24 Anny0920 阅读(408) 评论(0) 推荐(0) 编辑
摘要: 1、xml <!--app:labelVisibilityMode="labeled" --> <com.google.android.material.bottomnavigation.BottomNavigationView android:id="@+id/bottom_view" andro 阅读全文
posted @ 2020-05-14 11:13 Anny0920 阅读(973) 评论(0) 推荐(0) 编辑
摘要: ViewPager中height=wrap_content无效 public class MyViewPager extends ViewPager { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasur 阅读全文
posted @ 2020-04-22 23:13 Anny0920 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 简单new Gson,复杂格式用new GsonBuilder().registerTypeAdapter()解析, 常见错误: Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at li 阅读全文
posted @ 2020-04-07 13:47 Anny0920 阅读(386) 评论(0) 推荐(0) 编辑
摘要: binder共享内存 硬盘或者网络,,必须Serializable,序列化时会产生大量的临时变量,从而引起频繁的GC Parcelable只适用于android 跨进程调用,性能优,不能保证持续性,不能磁盘使用 SQLite和SharePreferences也是序列化 面试: 1、Android使用 阅读全文
posted @ 2020-04-06 22:31 Anny0920 阅读(141) 评论(0) 推荐(0) 编辑
摘要: //大量的反射,创建很多的临时变量,导致内存碎片,Serializable缺点 /** * 子类实现序列化,父类没有实现序列化,会报错 */ package com.anny.protobuf.serializable; import java.io.ByteArrayInputStream; im 阅读全文
posted @ 2020-04-06 21:26 Anny0920 阅读(339) 评论(0) 推荐(0) 编辑