Realization principle of kotlin coprocess

Implementation of traditional runnable interface In java, many time-consuming behaviors are performed by implementing the runnable interface and running these time-consuming tasks through threads, such as: public class Task1 implements Runnable{ @Override public void run() { try { Thread.sleep(2000); Sy ...

Posted by smclay on Mon, 31 Jan 2022 13:18:06 +0100

A Jun takes you to use the Kotlin brush algorithm

This series uses Java and Kotlin to solve the above algorithm problems. Because I am a rookie in the algorithm, some problems may not be the optimal solution. I hope to discuss with you~ GitHub of the project: Algorithm Two Sum Difficulty: simple Link: Two Sum code Java import java.util.Arrays; import java.util.HashMap; import java.util. ...

Posted by xxtobirichter on Sat, 29 Jan 2022 17:49:34 +0100

Encapsulation of hyperlink implementation of Android color text (Application of kotlin extension function)

1, Foreword Recently, we encountered such a problem when designing the interface. We can often see such an interface, which tells users the privacy terms and user agreement, and these color words directly point to the corresponding links At that time, the original idea was to set up multiple textviews to realize it. However, there would ...

Posted by taha on Thu, 27 Jan 2022 13:00:48 +0100

Android development technology -- migrating from LiveData to Kotlin data stream

Recommended by Haowen: Author: Android_ developer The history of LiveData dates back to 2017. At that time, the observer pattern effectively simplified development, but libraries such as RxJava were too complex for novices. To this end, the architecture component team created LiveData: an observable data storage class with autonomous life cy ...

Posted by embsupafly on Tue, 25 Jan 2022 20:43:21 +0100

Several usage scenarios of Kotlin delegate attribute in Android Development

Kotlin is really a beautiful development language. She has some great features that make Android development interesting and exciting. Delegate properties Is one of them. In this article, we will see how entrustment makes Android development easier. Basics First, what is delegation? How does it work? Although delegation seems magical, it is ...

Posted by BMN on Tue, 25 Jan 2022 19:21:37 +0100

Principle analysis of JectPack components -- ViewModel

In the JectPack component, ViewModel is mainly used to encapsulate the data related to the interface. Similarly, ViewModel has the ability of life cycle awareness. It always exists in memory before the destruction of Activity or Fragment onDetach; Especially after system configuration changes such as screen rotation, the interface data saved by ...

Posted by techrat on Tue, 25 Jan 2022 07:48:49 +0100

Several points that Kotlin entrustment must pay attention to

Delegation mode is a good alternative to inheritance. It is also a feature of kotlin language. It can implement delegation mode gracefully. It is also indispensable in the development process, but it is often underestimated. So let's pay attention to it today to fully grasp the characteristics and principles of kotlin delegation. 1, Delegate c ...

Posted by Anyaer on Mon, 24 Jan 2022 02:50:15 +0100

Jetpack Compose measurement process source code analysis

What will you learn in this article Through a code scenario, analyze the source code with the Layout function as the entry, and answer some questions. For example, if setting the size through the Modifier works? How is the measure method of the MeasurePolicy interface called? What is the measurement process in the Layout? How does the control ...

Posted by dman779 on Sun, 23 Jan 2022 20:40:02 +0100

Our use of DiffUtil may be biased

Our use of DiffUtil may be biased The front is my daily account. I think it looks boring. You can jump directly to the essence section Advantages of DiffUtil When I first came into contact with DiffUtil, I had a lot of good feelings for it, including: The algorithm sounds very nb and must be a good thing;The refresh logic of RecyclerVi ...

Posted by leapingfrog on Sun, 23 Jan 2022 15:32:45 +0100

Audio and video learning C language introduction

preface Now it is more and more difficult for Android junior and intermediate development engineers to find a satisfactory job. Of course, those with strength do not worry about a good job. If you happen to be a junior and intermediate engineer who wants to advance the direction of audio and video or is interested in NDK technology, you must b ...

Posted by MissiCoola on Sat, 22 Jan 2022 22:41:10 +0100