上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 169 下一页
摘要: 一,data类和普通类的区别 1, 主构造函数必须至少有一个参数,且参数标记为 val 或 var 数据类的主构造函数必须至少有一个参数,并且这些参数必须使用 val 或 var 声明。普通类则没有这样的要求。 2,数据类自动生成了以下方法: toString():生成格式化的字符串表示,如:Use 阅读全文
posted @ 2025-06-22 12:50 刘宏缔的架构森林 阅读(49) 评论(0) 推荐(0)
摘要: 一,代码: package com.example.okdemo1.activity import android.os.Bundle import android.util.Log import android.view.MenuItem import android.widget.Button 阅读全文
posted @ 2025-06-22 12:50 刘宏缔的架构森林 阅读(9) 评论(0) 推荐(0)
摘要: 一,代码 1,application public class MainApplication extends Application { private static MainApplication mApp; private static Context context; public Hash 阅读全文
posted @ 2025-06-14 15:23 刘宏缔的架构森林 阅读(42) 评论(0) 推荐(0)
摘要: 一,代码例子: package com.example.okdemo1.interceptor; import android.content.Context; import android.content.Intent; import android.os.Handler; import andr 阅读全文
posted @ 2025-06-14 15:22 刘宏缔的架构森林 阅读(17) 评论(0) 推荐(0)
摘要: 一,报错信息 Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag 原因: activity继承了context重载了startActivity方法,如 阅读全文
posted @ 2025-06-14 15:22 刘宏缔的架构森林 阅读(193) 评论(0) 推荐(0)
摘要: 一,报错信息: java.lang.RuntimeException: Can't toast on a thread that has not called Looper.prepare() 原因: 原因是Android中不允许在子线程中处理UI。如果要在子线程中处理UI那就要动态转到主线程中执行 阅读全文
posted @ 2025-06-14 15:22 刘宏缔的架构森林 阅读(258) 评论(0) 推荐(0)
摘要: 一,安装第三方库 库地址: https://mvnrepository.com/artifact/com.squareup.okhttp3/logging-interceptor 编辑 build.gradle,增加 // https://mvnrepository.com/artifact/com 阅读全文
posted @ 2025-06-14 15:22 刘宏缔的架构森林 阅读(129) 评论(0) 推荐(0)
摘要: 一,代码: 接口返回的json格式 接口类 package com.example.okdemo1.interfaces; import com.example.okdemo1.model.BaseEntity; import com.example.okdemo1.model.UserListEn 阅读全文
posted @ 2025-06-14 15:22 刘宏缔的架构森林 阅读(66) 评论(0) 推荐(0)
摘要: 一,安装第三方库 库地址: https://mvnrepository.com/artifact/com.squareup.retrofit2/retrofit 编辑build.gradle,添加 // https://mvnrepository.com/artifact/com.squareup. 阅读全文
posted @ 2025-06-14 15:22 刘宏缔的架构森林 阅读(67) 评论(0) 推荐(0)
摘要: 一,代码: 1,build.gradle的配置 buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-ru 阅读全文
posted @ 2025-06-14 15:22 刘宏缔的架构森林 阅读(18) 评论(0) 推荐(0)
上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 169 下一页