Android

(219)

android AppCompatButton 设置背景图片

遇到一个奇怪的问题,在 Android 项目中给 Button 设置背景图片,总是不生效。 ``` ``` ## 改用 androidx.appcompat.widget.AppCompatButton ```

Android APP 设置版本号,并显示在界面上

由于给客户定制的 Android APP 不需要发布到应用商店,没有一套统一的版本控制渠道。 只能先通过人肉查看版本号的方式,将版本号显示在界面上。 ## 设置版本号 app build.gradle 文件: 通过 ve

Android Kotlin 对字节 byte 中的某一位 bit 取反

Android Kotlin 中,需要对字节 byte 中的某一位 bit 取反 ## 取反代码 ``` fun toggleBit(byteValue: Byte, bitIndex: Int): Byte { //

Android Studio 中修改 App 的包名

## 需求背景 一套 Android 蓝牙控制硬件设备的程序,每个客户端界面和逻辑都有比较大的差异,所以想分成 N 个 git 代码仓库进行管理。 为了方便测试,例如在一个 Android 平板上安装多套不用版本的 App 进行测试

Android LiveData 实战总结

这周在重构一个 Android 平板蓝牙控制的 App,之前为了赶工期,代码写的比较乱, 正好这段时间赶上多个客户的定制要求,发现要一套代码实现多套差异化的需求,如果代码不好好规整根本改不动。 自己欠的技术债,总归是要还的。

Android Fragment 实现对蓝牙设备的参数配置页面

## 新建 fragment 新建一个 Blank Fragment。会自动创建对应的 layout xml 文件,但是 binding 需要自己手写。 ## layout binding ``` package com.s

NordicSemiconductor/Android-BLE-Library 监听连接状态变化

## 监听的目的 - Android App 界面显示当前的蓝牙连接状态:断开/连接中/已连接 - 在断开时,自动重连 ## 如何监听连接状态 (已废弃) 在 NordicSemiconductor/Android-BLE-

Android BLE 蓝牙操作设备三方库 NordicSemiconductor/Android-BLE-Library

## 为何要使用三方库 起因是我写的 Android 低功耗蓝牙 App 有几个现存的问题: - 写操作的并发问题导致写入失败,需要一个队列。iOS 内置了这个实现,甚至连微信小程序都实现了,但是 Android 官方没有实现,渣渣

android gradle 依赖版本号统一管理

## 在项目级 build.gradle 文件中 在 ext 代码块中定义 room_version。 ``` ext { kotlin_version = "1.6.20" nav_version = "2.4.

The project is using an incompatible version (AGP x.x.x) of the Android Gradle plugin

今天在编译一个 github 上的 Android 项目时,报错 > The project is using an incompatible version (AGP 8.1.0) of the Android Gradle plu