I was just surfing the Internet and was shocked to see a hot topic on Reddit. I thought Android had made big news and instantly thought of a title: Google's Android system is doing something incredible - monitoring the frequency of "Clap for Love". https://www.reddit.com/r/programming/comments/16iy537/android_has_a_separate_class_and_documentation_to/ Taking another look, it turns out that the Android development documentation provides a "SexualActivityRecord" class for recording the frequency of sexual life. https://developer.android.com/reference/androidx/health/connect/client/records/SexualActivityRecord Let's take a look at how Google engineers wrote this class. You can see that this class has a total of 3 constants, representing whether Sex takes protective measures:
The main public methods are getProtectionUsed(), getTime(), and getZoneOffset(). The first two are understandable, which are to get the protection measures and the time when they occurred, but what does the last ZoneOffset mean? Could you please explain it to me? As we all know, Kotlin has long been an officially supported development language for Android, so the code for this class is also written in Kotlin, with less than 100 lines in total: SexualActivityRecord.kt Well, this sharing ends here, and everyone is welcome to express their opinions. If you were responsible for writing this class, how would you implement it? |
<<: Review the feature upgrades and innovations of each generation of iPhone
>>: Five-minute technical talk | A brief analysis of Android 14 updates and upgrades
Mobile phones are not only our communication tool...
2021 Practical Course on Essential Scripts for An...
On the morning of April 3, the People's Daily...
Have you ever had this experience: after waking u...
Produced by: Science Popularization China Author:...
The core work of planning is to help companies fo...
[[121970]] Before writing this article, I want to...
Toutiao has always been criticized for its vulgar...
When creating content for a public account, there...
What is the price of Weinan Attendance Mini Progr...
People who often pay attention to health know tha...
In July 2023, the retail sales of passenger cars ...
1. Introduction After experiencing the wild growt...
In holiday marketing, we should take into account...
Application Management FAQ Q1. What is the regist...