- 博客(664)
- 资源 (1)
- 收藏
- 关注
原创 基于Android Room的三层架构设计与实现
本文探讨了在Android应用中实现三层架构的设计思路与具体实现,采用Kotlin语言及Android Studio开发工具。通过对Room数据库的集成,展示了数据层、业务层和表现层的详细代码和实现原理。本文旨在为开发者提供一个清晰的参考示例,以便在实际开发中高效地构建可维护、扩展性强的应用程序。表现层(Presentation Layer):负责UI的显示和用户交互。业务层(Business Logic Layer):处理应用程序的业务逻辑。数据层(Data Layer):负责数据的存储和管理。
2024-05-24 23:49:29 129
原创 Room注解无效原因
虽然子模块是用Java编写的,但是由于父模块使用了Kotlin,并且引入了Kotlin的插件,所以整个项目会默认使用kapt来处理注解。为了避免注解处理器不一致的问题,并且利用kapt对Kotlin的良好支持,你需要在子模块中使用kapt而不是来处理Room的注解。这是确保项目中所有注解处理器工作正常的最佳实践。软件开发联系我:[email protected]。
2024-05-24 15:55:49 158
原创 Observable 在被订阅时,Observable的内在执行逻辑
当Observable被订阅时,内部逻辑会执行订阅时的各种操作,包括调用操作符、连接Subscriber与Observable、发射数据项以及处理完成和错误情况。这个过程确保了数据流能够正确地从Observable发射到Subscriber,并在订阅时执行所需的操作。
2024-05-22 01:46:58 368
原创 Observable 发射时,为何会调用 Subscriber 的 onNext 方法
当Observable发射 “Hello, world!” 时,它会调用Subscriber的onNext方法,这是因为onNext是Subscriber接收和处理数据项的标准方法。在 ReactiveX 中,每当Observable发射一个数据项时,它都会通过调用onNext方法将数据项传递给订阅者。
2024-05-22 01:40:48 389
原创 对Room数据库更改的监听
使用Callable对象创建一个Maybe源,这意味着查询逻辑将在Maybe订阅时执行,并且如果Callable没有抛出异常,它将发出一个单一的成功值或完成无值(如果Callable返回null)。综上所述,这个方法结合了对数据库更改的监听和具体的数据库查询操作,形成一个可观察的数据流,非常适合用于实时更新UI或执行基于数据库更改的其他逻辑。这段代码是一个静态方法,用于创建一个观察数据库更改的Flowable,并执行给定的查询逻辑。方法应该是用于获取一个适合执行数据库操作的Executor,
2024-05-15 16:28:00 319
翻译 视图绑定View binding
如果为某个模块启用了视图绑定,系统会为该模块包含的每个 XML 布局文件生成一个绑定类。在模块中启用视图绑定后,它会为该模块中显示的每个 XML 布局文件生成一个绑定类。绑定类的实例包含对在相应布局中具有 ID 的所有视图的直接引用。考虑到这些因素,在某些情况下,最好在项目中同时使用视图绑定和数据绑定。您可以在需要高级功能的布局中使用数据绑定,在不需要高级功能的布局中使用视图绑定。视图绑定在生成代码时无法验证此属性的值。如需设置绑定类的实例,以便与 fragment 配合使用,请在 fragment 的。
2024-01-18 07:02:59 54
原创 Keil 退出debug时提示:“ Encountered an improper argument”
遇到了 Keil STM32 退出debug时提示:“Encountered an improper argument”,上网搜了一下,铺天盖地的答案,统一是不能有中文路径和中文文件名。退出debug前kill所有断点,要kill不是disable,我验证了这不能解决我的的问题。
2023-05-26 16:21:22 444
原创 android studio 改变avd虚拟机路径
android studio avd默认路径是C盘,一个虚拟机文件10G左右,很占用C盘空间。但可以修改配置文件改变avd虚拟机的保存路径。C:\Users\micro\.android\avd\Pixel_4_API_28.ini的内容改为如下:avd.ini.encoding=UTF-8path=D:\AndroidIDEA\.android\avd\Pixel_4_API_28.avdpath.rel=avd\Pixel_4_API_28.avdtarget=android-28
2022-02-13 22:49:20 2539
原创 android studio 改变.gradle默认目录
android studio 的默认目录是c盘,占用C盘空间。按照下面方式将.gradle默认目录改在D盘下。修改的文件是D:\Program Files\Android\Android Studio\bin\idea.properties然后重启android studio 生效。修改后的完整idea.properties文件如下:# Use ${idea.home.path} macro to specify location relative to IDE install..
2022-02-13 22:30:18 5629
原创 android mma
android mm编译报错:ninja: error: 'out/host/linux-x86/framework/host-libprotobuf-java-full.jar', needed by 'out/host/common/obj/JAVA_LIBRARIES/platformprotos_intermediates/classes-full-debug.jar'用mma即可...
2020-05-07 19:59:02 564
原创 repo Manifest Format
repo Manifest FormatA repo manifest describes the structure of a repo client; that isthe directories that are visible and where they should be obtainedfrom with git.The basic structure of a manife...
2020-01-29 20:17:59 372
原创 android 堆栈调试方法
// Throws AssertionError if the input is false.public static void assertTrue(boolean cond) { getCaller(); Log.w(TAG, "assertTrue cond: "+cond); if (!cond) { throw new AssertionEr...
2019-10-30 19:48:24 262
原创 init.rc service 无法启动
# start preinstall init: Could not ctl.start for service preinstall: File /vendor/bin/preinstall.sh(labeled "u:object_r:vendor_file:s0") has incorrect label or no ...
2019-07-24 16:29:15 9217 3
原创 git cherry-pick 多个commit
$ git cherry-pick b794641007e9a80f8f1e0704f89e614e95751609^..da6d0352518ddf1eb917fc614428f6deb5e4eee7前面的commit时间早于后面的commit时间前面的commit和后面的commit都会移过来,都是包含关系。...
2019-06-27 11:14:34 2564
原创 去掉Android is starting...
frameworks\base\core\res\res\values\strings.xml<!-- [CHAR LIMIT=40] Title of dialog that is shown when system is starting. --> <string name="android_start_title">Android is starting...
2019-06-14 16:28:01 3821 10
原创 error: expected reference but got (raw string)
环境:Android Studio 3.2.1Build #AI-181.5540.7.32.5056338, built on October 9, 2018JRE: 1.8.0_152-release-1136-b06 amd64JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.oWindows 7 6.1错误:app\buil...
2019-03-14 14:44:13 4533
原创 java sleep 暂停当前执行的线程
示例代码1:public class mySleep { public static void main(String[] args) { MyThread t1 = new MyThread("tSleep123"); t1.start(); try { Thread.sleep(100); //调用静态...
2019-01-05 22:54:31 553
原创 git log和tag一起显示
git log和tag一起显示--no-decorate, --decorate[=short|full|no] Print out the ref names of any commits that are shown. If short is specified, the ref name prefixes refs/heads/, refs/tags/ and re...
2019-01-04 18:19:12 6314
原创 adb push apk
adb shell suchmod 777 /dataexitexitadb push Y:\AA\my.apk /datacp /data/my.apk /system/app/my.apkchmod 644 /system/app/my.apk
2019-01-03 15:48:06 725
原创 git stash
git stash show stash@{0} 查看stash中修改了哪几个文件git show stash@{0} 查看stash中的具体修改内容如果要从多个文件中仅stash某一个文件,按如下操作:1. 不需要stash的文件用 git add 2. 剩下需要stash的文件 git stash --keep-index3. 恢复第一步add的文件 git reset...
2019-01-02 11:28:08 137
原创 android studio lint检查
android studio 3.2.1android:debuggable="true" 即编译生成debug版时,不会lint检查。编译生成release版时才会lint检查,一般提示如下:Lint found fatal errors while assembling a release target.To proceed, either fix the issues ide...
2018-12-27 12:02:16 1071
原创 android studio 编译后 app-debug.apk 和 app-release.apk 的区别
AS版本:Android studio 3.2.1app-debug.apk 和 app-release.apk 的核心区别在AndroidManifest.xml 。生成app-debug.apk时,编译器会自动在该apk的AndroidManifest.xml中添加 android:debuggable="true"生成app-release.apk时,编译器会自动在该apk的And...
2018-12-26 12:16:13 14052 4
原创 Android Studio 加载第三方jar包并提高framework.jar包优先级
android studio 版本 3.2.1framework源码编译出来的jar路径如下:out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jardroidlogic源码编译(vendor/amlogic/frameworks/core/java)出来的jar路径:out/target/comm...
2018-12-26 12:12:04 1361 2
原创 windows软链接mklink
mklink创建符号链接。MKLINK [[/D] | [/H] | [/J]] Link Target /D 创建目录符号链接。默认为文件 符号链接。 /H 创建硬链接,而不是符号链接。 /J 创建目录联接。 Link 指定新的符号链接名称。 ...
2018-11-12 16:53:18 1583
原创 linux 服务器增加用户和samba
adduser userxxxpasswd userxxx samba:/etc/samba/smb.conf smbpasswd -a userxxx
2018-11-06 17:32:10 937
原创 android 4.4 编译需要make 3.81 , android 6.0和7.1编译需要make 4.1
android 4.4 编译需要make 3.81 , android 6.0和7.1编译需要make 4.1从http://ftp.gnu.org/gnu/make/ 这里,分别下载make-3.81.tar.gz 和make-4.1.tar.gz分别进入目录:./configuremakesudo make installsudo rm /usr/bin/make...
2018-11-06 17:26:02 466
原创 linux 设置cpufreq
performance方法:在sys/devices/system/cpu/cpu0/cpufreq目录下:echo performance > scaling_governor ------------------------------Governor Description performance Run the CPU at the max...
2018-08-31 17:02:54 463
原创 ubuntu 安装samba
apt install samba samba-commonvim /etc/samba/smb.conf 修改如下:[homes] comment = Home Directories browseable = yes read only = no path = /root valid users = root 添加samba客户端用...
2018-08-27 13:52:39 3173
原创 jack server无法启动
启动失败,log如下$ jack-admin start-serverLaunching Jack server java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g -cp /home/libz/.jack-server/laun...
2018-08-22 18:40:39 6285
原创 ubuntu 开机自动挂载硬盘
sudo vim /etc/fstab在文件末尾增加/dev/sda1 /mnt/compile ext4 defaults 0 0/dev/sda2 /mnt/repo ext4 defaults 0 0 重新启动生效
2018-08-19 13:08:20 704
原创 SecureCRT ssh heartbeat
Anti-idle groupThis group contain controls designed to prevent your connection from being closed due to a lack of network traffic between SecureCRT and the remote machine.Send string n every n sec...
2018-08-15 10:46:39 366
原创 ubuntu 18.04编译android 7.1.2
error:flex-2.5.39: loadlocale.c:130: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed. Aborted (core dumped) 解决方法 : 在编译脚本中...
2018-08-11 21:33:53 2307
原创 ubuntu 16.04 server 设置固定IP
打开 /etc/network/interfaces后将原有的下面内容# The primary network interfaceauto ens33iface ens33 inet dhcp 改为如下内容:# The primary network interfaceauto ens33#iface ens33 inet dhcpiface ens33 inet st...
2018-08-01 21:23:04 1588
原创 git log --stat
git log --stat显示每个log的commit 标题,并且显示哪几个文件被修改了,各个文件增加和删除了多少行。
2018-07-18 19:01:46 1140
原创 perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
$ git push --mirror [email protected]:xxx.git perl: warning: Setting locale failed.perl: warning: Please check that your locale settings: LANGUAGE = "en_US:", LC_ALL = (unset), ...
2018-07-16 17:35:03 2849 1
原创 gitolite修复authorized_keys丢失以及仓库损坏
gitolite 修复$ gitolite setup -pk git.pub Initialized empty Git repository in /home/git/repositories/xxx.git/WARNING: /home/git/.ssh/authorized_keys missing; creating a new one (this is normal o...
2018-07-14 12:51:03 850
原创 HID增加按键
common/drivers/hid/hid-input.cstatic const unsigned char hid_keyboard[256] = { 0, 0, 0, 0, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38, 50, 49, 24, 25, 16, 19, 31, 20, 22, 47, 17, 45, 2...
2018-07-10 10:02:52 1060
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人