Newstrong's 博客

未分类
未分类

Prefer Function Reference over Lambda in Kotlin? Wrong!

Using lambda as callback is very common in Jetpack compose, but do you know you can also use function reference to replace the lambda? When I first heard about this function reference, I thought the function reference must be better. Unlike anonymous function …

2025年3月21日 62点热度 0人点赞 newstrong 阅读全文
未分类

ZonedDateTime toString compatability with ISO 8601

I am trying to ensure that calling toString() on my ZonedDateTime Object will comply with ISO-8601 format. The documentation for the toString() method states: ...The output is compatible with ISO-8601 if the offset and ID are the same Does this mean that there…

2024年10月29日 57点热度 0人点赞 newstrong 阅读全文
未分类

Jetpack 自定义 DropDownMenu

@Composable fun DropDownMenu(initPosition: Int, values: List<String>, onValueChange: (String) -> Unit) { val expanded = remember { mutableStateOf(false) } val itemPosition = remember { mutableIntStateOf(initPosition) } Box( modifier = Modifier .backgr…

2024年10月11日 57点热度 0人点赞 newstrong 阅读全文
未分类

Compose 动画 (三) : AnimatedVisibility 从入门到深入,实现组件的隐藏和显示

1. AnimatedVisibility 是什么 AnimatedVisibility是Android Compose中的一个高级别动画API。 可以实现Compose组件的显示和隐藏,并且可以指定显示/隐藏时候的动画效果。(EnterTransition/ExitTransition) 和 animateXxxAsState、animateContentSize、Crossfade、AnimatedContent 这几个API一起,都是Compose的高级别动画API,是比较易用的。 2. AnimatedVi…

2024年10月10日 93点热度 0人点赞 newstrong 阅读全文
未分类

moshi 极简封装

目录 前言 Jackson的基本使用 Jackson获取泛型类型的巧妙处理 借鉴jackson优化moshi的封装 使用 总结 前言 之前写了一篇文章是介绍moshi的基本使用和实战,感兴趣的可以先看一下对kotlin友好的现代 JSON 库 moshi 基本使用和实战 在那篇文章中,我们最后针对moshi做了个封装,代码大致如下: import com.squareup.moshi.JsonAdapter import com.squareup.moshi.Moshi import com.squareup.mo…

2024年9月28日 68点热度 0人点赞 newstrong 阅读全文
未分类

自定义的BasicTextField,只包含 BasicTextField 的基本功能和 placeHolder

/** * 自定义的BasicTextField,只包含 @see BasicTextField 的基本功能和 placeHolder * * @param placeHolder 没有输入的占位符 */ @Composable fun CustomBasicTextField( value: String, onValueChange: (String) -> Unit, placeHolder: (@Composable BoxScope.() -> Unit)? = null, modifier:…

2024年9月25日 91点热度 0人点赞 newstrong 阅读全文
未分类

FindClass from any thread in Android JNI

JavaVM* gJvm = nullptr; static jobject gClassLoader; static jmethodID gFindClassMethod; JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *pjvm, void *reserved) { gJvm = pjvm; // cache the JavaVM pointer auto env = getEnv(); //replace with one of your classes in the li…

2024年9月20日 590点热度 0人点赞 newstrong 阅读全文
未分类

Android中进程相关信息获取,pid,进程名

1. 获取pid int pid = android.os.Process.myPid(); 2. 获取进程名及其他信息 ActivityManager mActivityManager = (ActivityManager) getContext().getSystemService(Context.ACTIVITY_SERVICE); for (ActivityManager.RunningAppProcessInfo appProcess : mActivityManager .getRunningAppPr…

2024年9月20日 46点热度 0人点赞 newstrong 阅读全文
Android

信号机制和Android natvie crash捕捉

一、信号机制 image.png 函数运行在用户态,当遇到系统调用、中断或是异常的情况时,程序会进入内核态。信号涉及到了这两种状态之间的转换。 1、信号的接收 接收信号的任务是由内核代理的,当内核接收到信号后,会将其放到对应进程的信号队列中,同时向进程发送一个中断,使其陷入内核态。 此时信号还只是在队列中,对进程来说暂时是不知道有信号到来的。 2、信号的检测 进程陷入内核态后,有两种场景会对信号进行检测: 进程从内核态返回到用户态前进行信号检测 进程在内核态中,从睡眠状态被唤醒的时候进行信号检测 当发现有新信号时,…

2024年9月18日 44点热度 0人点赞 newstrong 阅读全文
未分类

迄今为止最好的用于编程或软件开发的Prompt

在开发中,我们经常使用AI来帮助我们进行编程活动,以下是一个Prompt的例子,转自:https://www.reddit.com/r/PromptEngineering/comments/1eogo2a/coding_system_prompt/?rdt=45014 中文 提示:您是一个高级 AI 模型,旨在通过应用复杂的推理技术组合来解决复杂的编程挑战。为了确保您的代码输出在技术上准确、安全、高效且有据可查,请遵循以下结构化说明:分解编码任务:首先应用思维链 (CoT) …

2024年8月25日 57点热度 1人点赞 newstrong 阅读全文
123

近期文章

  • Android MediaCodecList 解码器能力探测方案
  • git类图形化log
  • ZSH Git Plugin 别名表格
  • Prefer Function Reference over Lambda in Kotlin? Wrong!
  • ZonedDateTime toString compatability with ISO 8601
标签聚合
gpt 开发 googleplay 技术 kotlin

COPYRIGHT © 2026 Newstrong's 博客. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

蜀ICP备2024057367