Kotlin collaboration + Retrofit is the most elegant network request

1. Introduction Retrofit's support for collaborative processes is very rudimentary. The use of kotlin does not conform to kotlin's elegance interface TestServer { @GET("banner/json") suspend fun banner(): ApiResponse<List<Banner>> } //Network request for parallel exception capture fun oldBanner(){ viewModelScope. ...

Posted by mightymax on Sat, 15 Jan 2022 12:56:02 +0100

Messenger source code analysis

When I first came into contact with messenger and Handler, I always felt that they were a little similar, because they both had a "send(Message message)" method and processed messages serially. Later, I learned from the source code that they were more than similar. Messenger is an enhanced version of Handler that supports cross proces ...

Posted by rajsekar2u on Sat, 15 Jan 2022 09:39:09 +0100

Android Studio source code learning record

1, HashMap < string, string > /* * HashMap: it is a Map interface implementation based on hash table. * the hash table is used to ensure the uniqueness of keys.  *  * HashMap<String,String> * key: String * value: String  */ package cn.itcast_02; import java.util.HashMap; import java.util.Set; public class HashMapDemo { publ ...

Posted by sriphp on Sat, 15 Jan 2022 02:31:01 +0100

Cool ~ RecyclerView parallax decorator ParallaxDecoration

According to the old rule, the picture above first to see if it is what you want. Meituan effect:Final effect:A graphic analysisNext, I want to write a simple example. First analyze the layout, as shown in the figure below. The outermost layer is NestedScrollView, and then nest a LinearLayout header, a TabLayout selector in the middle and a Vie ...

Posted by lisa3711 on Sat, 15 Jan 2022 01:00:39 +0100

[kotlin] null pointer check in kotlin

kotlin learning - null pointer check 1.Java In java code, null pointer errors are often reported, methods pass parameters, operate on data, or call collections. The general operation is to add a null judgment process 2.kotlin nullable type system **In kotlin, all parameters and variables cannot be null by default, * * if NULL is passed, ...

Posted by kitegirl on Sat, 15 Jan 2022 00:31:42 +0100

Android10.0 Feature - Dark Mode, Dark Theme

Thematic styles about projects are a common feature, especially in app s of some music types, and when I watched Android 10 before, I said that the new feature included Dark Mode, which is just a chance to talk about it together (recently busy, messy and can only be charged in the middle of the night) If there is a need for skin replacement ...

Posted by kanikilu on Fri, 14 Jan 2022 23:05:16 +0100

Customize the View and draw the Android radar map with Kotlin

stay Custom View and Radar chart Based on the two blogs, I have made some modifications. Here I summarize my own learning experience. There are several ways to customize the View typedefinitionCustom composite controlMultiple controls are combined into a new control to facilitate multiple reuseInherit system View controlIt inherits from TextV ...

Posted by not_skeletor on Fri, 14 Jan 2022 21:46:18 +0100

[kotlin] kotlin's basic grammar

kotlin learning - basic grammar 1. Introduction Compare java 1. Simple syntax and less code 2. Advanced Grammar 3. Language security. Eliminate null pointers 4. 100% compatible with Java 2. Operation Online website: https://play.kotlinlang.org/ val immutable = final var non final var a =10 (automatic derivation type) No semicol ...

Posted by arimakidd on Fri, 14 Jan 2022 21:31:43 +0100

Kotlin collaboration 5 - using kotlin collaboration in Android

Kotlin collaboration series article navigation: Kotlin process I - Coroutine Kotlin collaboration process 2 - Channel Kotlin collaboration process III - data Flow Kotlin collaboration process IV -- Application of Flow and Channel Kotlin collaboration 5 - using kotlin collaboration in Android 1, Android MVVM architecture Architecture diagram of ...

Posted by blindSpot on Fri, 14 Jan 2022 20:49:00 +0100

Android: simple understanding and use of Android learning notes Bitmap

Android Bitmap I Definition of Bitmap Bitmap is one of the most important classes of image processing in Android system. It can be used to obtain the image file information, cut, rotate and zoom the image, and save the image file in a specified format. There are two main uses of Bitmap: 1. Set the background for ImageView2. Use as canva ...

Posted by BigMike on Fri, 14 Jan 2022 14:05:38 +0100