implementation ‘com.google.code.gson:gson:2.8.4’
"prizeList": [
{
"prizeName": "吹风机",
"prizeImage": "https://stg1-eco.cdn.lifeapp.pingan.com.cn/cmsinfo/upload/prize/8vbpebhs-_-_-1699604523564.png"
},
{
"prizeName": "笔记本电脑",
"prizeImage": "https://stg1-eco.cdn.lifeapp.pingan.com.cn/cmsinfo/upload/prize/6g4s24vq-_-_-1685501815353.png"
},
{
"prizeName": "1000优惠券",
"prizeImage": "https://stg1-eco.cdn.lifeapp.pingan.com.cn/cmsinfo/upload/prize/en4s2et7-_-_-1685501848830.png"
},
{
"prizeName": "1000积分",
"prizeImage": "https://stg1-eco.cdn.lifeapp.pingan.com.cn/cmsinfo/upload/prize/mzaewrgw-_-_-1685442289440.png"
}
]
使用
val gson = Gson()
val fromJson =
gson.fromJson<List<PrizeBean>>(json, object : TypeToken<List<PrizeBean>>() {}.type)
println(fromJson[0].prizeName)
Log.d(TAG, "initView: ${fromJson[0].prizeName}")
bean类(只要数组里面的json)
data class PrizeBean(
val prizeImage: String,
val prizeName: String
)
viewBinding {
enabled true
}
2.adb
(1)连接应用商店,观影的设备
①adb connect 172.18.9.121
(2)连接音乐的设备
①adb connect 172.18.25.87
②adb connect 172.18.9.52 :性能差的那个
(3)息屏设置
①adb shell settings put system screen_off_timeout 100000000
(4)查看当前项目的Activity
①adb shell dumpsys window | findstr mCurrentFocus
②Mac:adb shell dumpsys window | grep mCurrentFocus?
(5)启动Activity
①adb shell am start -n com.jmgo.appstore/.detail.ui.AppStoreDetailActivity
(6)网络映射到电脑
①adb shell settings put global http_proxy 172.18.14.244:8888
②adb shell settings put global http_proxy :0
(7)卸载
①adb shell pm uninstall com.jmgo.launcher
(8)获取系统版本
①adb shell getprop ro.build.version.release
(9)打开应用
①adb shell am start com.jmgo.arwen
②adb shell am start com.jmgo.appstore
3.Android studio快捷键
(1)Mac
①Control+shift+J:可以让代码上移动
(2)Windows