# HistoryEchoes **Repository Path**: tanjunbin/HistoryEchoes ## Basic Information - **Project Name**: HistoryEchoes - **Description**: HistoryEchoes Kotlin实战简单项目一个历史上的今天(网络请求API:https://liangjingkanji.github.io/Net/interceptor.html)(历史上的今天API:https://www.alapi.cn/api/11/api_document) 利用Gson 解析数组数据[],和对象数据{} - **Primary Language**: Android - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2025-07-02 - **Last Updated**: 2025-07-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # HistoryEchoes #### 介绍 HistoryEchoes Kotlin实战简单项目一个历史上的今天(网络请求API:https://liangjingkanji.github.io/Net/interceptor.html)(历史上的今天API:https://www.alapi.cn/api/11/api_document) 利用Gson 解析数组数据[],和对象数据{} #### 软件架构 软件架构说明 #### 安装教程 //协程 implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.0") // 网络请求 implementation("com.squareup.okhttp3:okhttp:4.11.0") implementation("com.github.liangjingkanji:Net:3.7.0") //JSON序列化库 implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3") // gson implementation ("com.google.code.gson:gson:2.8.9") implementation("androidx.recyclerview:recyclerview:1.4.0") #### 使用说明 object JsonParse { fun getDataList(json: String): List? { val gson: Gson = Gson() // 使用gson库解析JSON数据 // 创建一个TypeToken的匿名子类对象,并调用对象的getType()方法 val listType: Type = object : TypeToken?>() { }.getType() // 把获取到的信息集合存到shopList中 val dataList: List? = gson.fromJson?>(json, listType) return dataList } fun getDataDetail(json: String): DataX{ val gson: Gson = Gson() // 使用gson库解析JSON数据 // 创建一个TypeToken的匿名子类对象,并调用对象的getType()方法 val type: Type = object : TypeToken() { }.getType() val dataDetail: DataX = gson.fromJson(json, type) return dataDetail } fun getDataT(json: String):T{ val gson: Gson = Gson() // 使用gson库解析JSON数据 // 创建一个TypeToken的匿名子类对象,并调用对象的getType()方法 val type: Type = object : TypeToken() { }.getType() val dataT: T = gson.fromJson(json, type) return dataT } } #### 参与贡献 1.网络请求API:https://liangjingkanji.github.io/Net/interceptor.html) 2.(历史上的今天API:https://www.alapi.cn/api/11/api_document) #### 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)