当前位置:网站首页>Android kotlin learning
Android kotlin learning
2022-06-27 18:23:00 【Manon Park】
- Kotlin Training camp courses
https://codelabs.developers.google.com/kotlin-bootcamp/
This is a course that you can learn Kotlin Basic knowledge courses .Android Applications can also use Java Development , but Google in Android Announcement in development Kotlin First And from Kotlin Created an easy to use Android API, So if you want to learn from now on Android, As to the Kotlin Study . Better go to .
- Android Kotlin basic course
https://codelabs.developers.google.com/android-kotlin-fundamentals/
Understand in Kotlin Created in Android Application basics .
Introduction to the contents of each course
Because the content is written in English , It may be difficult to get started .
I can explain the content of each course in Japanese , So it may be easier to see the content .
Kotlin Training camp courses
I will explain Kotlin Bootcamp Each project of the course .
https://codelabs.developers.google.com/kotlin-bootcamp/
Welcome to the course
https://codelabs.developers.google.com/codelabs/kotlin-bootcamp-welcome/#0
You need programming experience in object-oriented languages or IDE Development experience to participate in the course . Course content is written .
Start (3 A mission ) 9%
The contents are as follows , You can get to know Kotlin.
- Kotlin be relative to Java The advantages of
- robust ( For example, mechanisms that are unlikely to cause null exceptions )
- Complete and readable code (Java One line of code can write 20 Row or so )
- And Java compatible ( have access to Java library , Can be Kotlin Put it in Java In the project )
- How to install JDK( function Kotlin Program needs to be installed Java)
- IntelliJ IDEA Installation (Kotlin Easy to write IDE install )
- Try to use “Kotlin REPL” Show Hello World
- Use REPL = Read-Eval-Print Loop, It reads with Kotlin Code written , Execute it and output the results . It's like a shell .
- Kotlin Basic syntax
Kotlin Of Hello World
fun printHello() {
println ("Hello World") } printHello() Kotlin Basic knowledge of (4 A mission )21%
- Study Koltin Basic syntax . Let's try to write a program , At the same time Kotlin REPL * Actually enter it in .
- val, var: Variable declarations , Can be reassigned
- Int、Double And its transformation
- Strings and string templates
- If something else
- Time : About Kotlin Version of switch
- Nullability and how to deal with it
- Kotlin It is divided into Nullable The type and NunNull type , So if you do it in a programming language that is not yet separate , You should do this .
- list , Array
- for loop
* REPL = Read-Eval-Print Loop, Read Kotlin Written code , perform , Output results . It's like a shell .
function (6 A mission ) 40%
- Create a Kotlin File, Definition main function , Output Hello World.
- How to pass parameters in the main function
- stay Kotlin in ,if Statements, etc. have values , So it can be written like this
val isHot = if (temperature > 50) true else false - How to make a function
- Code examples using functions
- Default parameters
- Single expression functions
fun isTooHot(temperature: Int) {
return temperature > 30 } fun isTooHot(temperature: Int) = temperature > 30 - use filter() Filter the contents of the list
SequenceAnd a normal list .( I think it's a little difficult here , But even if you don't understand , natural Android Development is no problem ( The computational complexity is so high that asSequence Things are difficult to deal with ), So I think I can skip .)- Ramda
object-oriented programming (7 A mission ) 62%
- Creating Aquarium Class , We will touch Kotlin Class .
- Data class : Classes with useful properties
- Use keywords singleton: object You can easily create a singleton ( There is a story about interface delegation ( class A:B by C), But this function is very convenient , But it's not a messy function , So even if you continue not to understand . Let's go )
- Enumeration class
- Sealing class : image enum You can also enumerate , Classes that can be instantiated , It can be used in error handling and other situations , It seems better to have a look .
Expand (4 A mission ) 75%
- There's a way , Return to one Pair
, It was written at the beginning , But at first sight it is hard to understand , So let me explain .
It's a story , You can use the following List The return name of the method is Pair Instance of class for ,partition() So that we can put List Divided into two groups. .
>>> data class Fish(val name : String) >>> val fishList = listOf(Fish("medaka"), Fish("koi"), Fish("maguro")) >>> fun isFreshWater(fish: Fish) = listOf("medaka", "koi").contains(fish.name) >>> val twoLists = fishList.partition {
isFreshWater(it) } // >>> println(twoLists) ([Fish(name=medaka), Fish(name=koi)], [Fish(name=maguro)]) >>> println("freshwater: ${twoLists.first}") freshwater: [Fish(name=medaka), Fish(name=koi)] >>> println("saltwater: ${twoLists.second}") saltwater: [Fish(name=maguro)] - How to make Pair:“A” To “B” You can create “A” and “B” Of Pair Class
- One can be disassembled Pair The story of . Yes, it can be decomposed into val (a, b) = pair.
- How to make and use lists .
- const vs val The story of :const Is determined at compile time . In this way
- How to write extension functions 、 attribute
Generic (3 A mission )84%
It is used for list types , for example List.
- How to use basic generics
- How to declare Nullable、NonNull The generic type
- Generic input and output
- The story of adding generics to functions
- Use specific types of stories .( This will resolve the generic type at compile time , So you can access the class name 、 Cast and determine )
Function operation (5 A mission ) 100%
About Kotlin There has been a deeper story .
- How to make and use annotations
- Break by tag ( Avoid double circulation, etc )
- Easy to use ramda
- Try making it yourself with () and that with ()
- Operation yield, etc
- Talk about using inline functions to reduce memory and CPU expenses
- SAM transformation A story , You can write a method that has only one abstract method as lambda Class implementation of .
Android Kotlin basic course
I will explain Android Kotlin Fundamentals Course Every project of .
https://codelabs.developers.google.com/android-kotlin-fundamentals/
Android Kotlin Basic knowledge of : Welcome to the course
https://codelabs.developers.google.com/codelabs/kotlin-android-training-welcome/index.html?index=..%2F..android-kotlin-fundamentals
There are explanations for each course .
The first 1.0-1.4 course “ Build your first app ”
- Explain how to make Android Studio And Kotlin Use a combination of . from “Hello World” Start , Use the image file to view it , And add a click handler .
- Explain your Android How the project is organized , How to be in Kotlin Of Android Using and modifying views in applications , And how to maintain backward compatibility . You will also learn about Android API Level and Android Jetpack library .
01.0: install Android Studio
01.1: Start
01.2: Basic application analysis
01.3: Picture resources and compatibility
01.4: Learn to help yourself
The first 2.1-2.4 course “ Layout ”
- How to use Android Studio Layout editor and how to use LinearLayout * 1 and ConstraintLayout * 2.
- Create an application that receives user input and displays it .
findViewById()In this lesson , You will also learn how to use data binding to eliminate inefficiencies .
* 1 LinearLayout: Simple arrangement Views
Layout * 2 ConstraintLayout: Describe the layout with constraints in the current most commonly used layout .
02.1: Use the layout editor for linear layout
02.2: Add user interaction
02.3: Use the layout editor to constrain the layout
02.4: Data binding Basics
The first 3.1-3.3 course “ Navigation ”
- Explain how to navigate through an application .
- First , establish Fragment * 1 And add it to the application . And then use Android Studio Navigation map add navigation to your app . Create a navigation drawer * 2 And add an option menu to the application . then , The navigation drawer can be connected with back stack * 3 Used together . Learn how to launch another... From an application Activity * 4.
* 1 fragment : A component in the user interface .Normal Enter Activity
* 2 Navigation Drawer: Sliding out from the side Menu
* 3 Back stack: A mechanism that can be returned through a return button, etc
* 4 Activity: Components that provide screens , It includes Fragment .
03.1: Create clips
03.2: Define the navigation path
03.3: Start an external activity
The first 4.1-4.2 course “ Activity and fragment lifecycles ”
- Explained Activity and Fragment And how to deal with it in complex situations .
- Start developing with applications that contain lifecycle errors , Add logging , Better understand lifecycle Events , Fix bugs and add value to your application . Then understand Android Jetpack Lifecycle Library , It can easily manage lifecycle Events .
04.1: Lifecycle and logging
04.2: Complex life cycle situations
The first 5.1-5.4 course “ Architecture components ”
- Explain how to use ViewModel and LiveData *.
- Learn how to use the... That still exists after the screen is rotated ViewModel.
- take UI Data is packaged in LiveData in , And add a Observer To understand LiveData When the value changes .
- Use LiveData and ViewModel And DataBinding Direct communication layout and ViewModel And there's no need to be Fragment Middle pass . This technique can reduce code and simplify it .
* ViewModel and LiveData Is a component that moves in consideration of its life cycle . You can learn how it works .
05.1: ViewModel and ViewModelFactory
It seems easier to start after reading this explanation .
https://developer.android.com/topic/libraries/architecture/viewmodel?hl=ja
Overview overview
- stay Android On , Every time a conflicting change occurs, it is recreated Activity and Fragment Example ( Occurs when the screen rotates, etc ).
- As the instance is recreated , The data stored there will be lost .
- You can to SavedInstanceState Do the same thing , But if you have a lot of data , For example, list data , It's not suitable for .
- stay Activity or Fragment Direct asynchronous call in API when , It needs to be cleaned at the time of destruction , To avoid memory leaks . Besides , Resources are also wasted , For example, call again .
stay Activity or Fragment Write data communication in 、 visit DB etc. , Cause bloated and unpredictable .
ViewModel Designed to be more than Fragment、Activity Etc. have a longer survival time .
You can also easily provide ViewModel Create the test , Because you are ViewModel There is no view or lifecycle in .
05.2: LiveData and LiveData The observer
It seems easier to start after reading this explanation .
https://developer.android.com/topic/libraries/architecture/livedata?hl=ja
05.3: And ViewModel and LiveData Data binding
05.4: LiveData transformation
Overview overview
- LiveData Is a class , It holds data that can be observed according to the life cycle .
- image liveData.observe(activity, {data-> ...}) Same pass Activity And observe .
- Only when the Activity You will not be notified until the lifecycle is active .
- When Activity When the lifecycle is deleted , namely onDestory When called , The observer is removed .
Why use LiveData?
Official short
The first 6.1-6.3 course “ Room database and coordination process ”
- Room * 1 Explain how to use the library .
- Learn how to use Kotlin The coroutine handles the database instead of the main thread . You can also learn about ViewModel and LiveData.
* 1 One makes SQLite Easy to handle Libraries
06.1: Create a room database
06.2: Assistance and room
06.3: Use LiveData Control button status
The first 7.1-7.5 course “ Recycle bin view ”
- Explain how to use RecyclerView Effectively display items in lists and gravel .
- Explain how to use RecyclerView Create lists that are easy to maintain and expand .
- Allows you to click RecyclerView Projects in China .
- Explains how to add one or more layouts , For example, when you want to add a header .
07.1:RecyclerView Basics
07.2:DiffUtil and RecyclerView Data binding of
07.3: with RecyclerView Of GridLayout
07.4: And RecyclerView Project interaction
07.5: RecyclerView The title in
The first 8.1-8.3 course “ Connect to the Internet ”
- I explained how to use a named Retrofit To get and display data .
- You will learn how to handle errors , How to use the name Glide The library of displays from Internet Image , And how to RecyclerView Display the acquired image in .
08.1: Get data from the Internet
08.2: Load and display images from the Internet
08.3 Use Internet data filtering and detailed view
The first 9.1-9.2 course “ The repository ”
- Description is used to abstract the data layer and provide clean API Technology .
- You can also learn how to use WorkManager Perform optimized background tasks .
09.1: The repository
09.2: Work manager
The first 10.1 ~ 10.3 course “ Designed for everyone ”
- Explain the basics of application design .
- I'm making an application to find Google Developer Group (GDG) Explain at the party .
10.1: Style and theme
10.2: Material design 、 Size and color
10.3: Designed for everyone
边栏推荐
- d3dx9_ How to repair 40.dll? Win10 system d3dx9_ What if 40.dll is lost?
- How much room does Migu video have for development without relying on sports events?
- Software testing - the concept of testing, the detailed introduction of unit testing, and how to design test cases
- 软件测试-测试的概念,单元测试的详细介绍,如何设计测试用例
- leetcode 200. Number of islands
- (POJ - 1847) tram (shortest circuit)
- Written in eclipse, problems after querying the database connection
- Unity 阴影——阴影平坠(Shadow pancaking)
- 全面解析零知识证明:消解扩容难题 重新定义「隐私安全」
- Wanzhou gold industry: what are the common gold investment and warehouse building modes?
猜你喜欢

Related configuration commands of Huawei LACP

07. Express routing

09 route guard authenticates URL

Wanzhou gold industry: what are the common gold investment and warehouse building modes?

Autodesk Navisworks 2022软件安装包下载及安装教程

【多线程】线程通信调度、等待集 wait() 、notify()

ROS "topic" programming implementation
![[UVM foundation] UVM_ Is in agent_ Active variable definition](/img/55/a14fbde43b25ccdc5a7996121396f9.jpg)
[UVM foundation] UVM_ Is in agent_ Active variable definition

d3dx9_ How to repair 40.dll? Win10 system d3dx9_ What if 40.dll is lost?

How to improve it electronic equipment performance management
随机推荐
如何提升IT电子设备效能管理
Electronic smart package tutorial
Shardingsphere & Atlas & MYCAT comparison
leetcode 92. Reverse linked list II
(5) SPI application design and simulation verification 3 - verification code implementation
Explain the distributed computing of Apache skywalking OAP in detail
Ti Click: quickly set up tidb online laboratory through browser | ti- team interview can be conducted immediately
Teach you how to realize pynq-z2 bar code recognition
【多线程】线程通信调度、等待集 wait() 、notify()
Popularization of MCU IO port: detailed explanation of push-pull output and open drain output
Hash encryption
SQLite net (SQLite is used by unity, WPF and WinForm)
Missing d3d10 How to repair DLL files? Where can I download d3d10.dll
On array-_-
Offline disk group
leetcode 82. Delete duplicate Element II in the sorting linked list
LACP details
Analysis of shardingsphere core source code
广汽三菱全新欧蓝德首次国内亮相于年内上市 产品力全面焕新
Halcon: discrete digital OCR recognition