使用 Kotlin 编写 Android 应用时要注意的一个小坑

nullable 是个好东西,但可惜 Java 没有呀~

Read more   2/26/2020 posted in  Android

Android Studio 编写 JNI 代码时的一个小问题

'AttachCurrentThread' in '_JavaVM'; did you mean 'attachCurrentThread'?
auto result = JVM.load()->AttachCurrentThread(&env, nullptr);
^~~~~~~~~~~~~~~~~~~
attachCurrentThread
/opt/android-sdk/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/jni.h:1058:10: note: 'attachCurrentThread' declared here
jint attachCurrentThread(JNIEnv** p_env, void* thr_args)
Read more   6/12/2019 posted in  Android

C++ 线程多次回调 JNI 到 Java 时的一个坑

JNI 是个好东西,但是用起来千万要小心。

Read more   5/28/2019 posted in  Android

RecyclerView with SortedList

0x00 Background

It is common for a list to have a specific order, assuming you have a bunch of contacts in your list, you might want to sort them in alphabet order, or if you have some kind of notes, you like to sort them in time order. These sorting requirements are common and easy, you can just use a list and a comparator, just use the compare() method, however some are much complicated, like different kind of data, different sort rules, how to deal with the duplicated names. Also, you need to handle all the changes like insert, remove and updates. Sometimes it can be annoying, no worry, we have SortedList.

Read more   8/13/2018 posted in  Android

Android dynamic UI for phones and tablets

This is mainly for Phone UI and Tablet UI. Since Android has supported split screen since Android OS 7.0. It's not suitable to use isTablet to check whether App runs on a tablet. It might be a tablet but shows a phone UI.

Read more   6/26/2018 posted in  Android

智能生活的坚实一步-- Android Things 1.0

2018 年 Google IO 大会给我们带来了最新的 Android Things 1.0 版本,也为与会者提供了一份完整的 Android Things develop kit。刚好有一个好朋友也去参加了这一次的 IO(羡慕ing),拿到了一套,并且慷慨的送给了我,在此先谢谢方大神!
kDmfBBTATlKjSFoZz89uGw_thumb_891

Read more   6/1/2018 posted in  随笔

First step to love writing wikis and blogs

With the power of Markdown.

Read more   5/4/2018 posted in  随笔

Different ways to send problem report in app with screenshots

0x00 Requirements background

When an application released and get used by customers, crashes and ANRs are usually the most annoying issues for developers, it's hard to get the specific context of the entire usage.

Read more   4/12/2018 posted in  Android

A simple Android JankDetecter design and implementation

0x00 Background

When we developing and releasing an Android Application, we might encounter issues like Frozen Frames(FF) or Janks(according to Android Developer), to detect Janks during developing or logging, we can add a simple detector to check whether an application is going through a Jank.

Read more   3/10/2018 posted in  Android

Android App Layout performance optimization investigation

Slow rendering can cause Frozen Frames issue.
To avoid Slow Rendering issue. Try to analysis Android App with tools.

Read more   2/1/2018 posted in  Android