ENGLISH

Android Developement with Kotlin

Book information

Publisher
Pack Publishing
Year
2017
ISBN
9781787123687
Language
english
Format
PDF
Filesize
6 MB (6777783 bytes)
Pages
561\514
Time added
2020-03-03 17:45:03

Description

Nowadays, improved application development does not just mean building better performing applications. It has become crucial to find improved ways of writing code. Kotlin is a language that helps developers build amazing Android applications easily and effectively. This book discusses Kotlin features in context of Android development. It demonstrates how common examples that are typical for Android development, can be simplified using Kotlin. It also shows all the benefits, improvements and new possibilities provided by this language. The book is divided in three modules that show the power of Kotlin and teach you how to use it properly. Each module present features in different levels of advancement. The first module covers Kotlin basics. This module will lay a firm foundation for the rest of the chapters so you are able to read and understand most of the Kotlin code. The next module dives deeper into the building blocks of Kotlin, such as functions, classes, and function types. You will learn how Kotlin brings many improvements to the table by improving common Java concepts and decreasing code verbosity. The last module presents features that are not present in Java. You will learn how certain tasks can be achieved in simpler ways thanks to Kotlin. Through the book, you will learn how to use Kotlin for Android development. You will get to know and understand most important Kotlin features, and how they can be used. You will be ready to start your own adventure with Android development with Kotlin Preface What this book covers What you need for this book Who this book is for Conventions Reader feedback Customer support Downloading the example code Errata Piracy Questions Beginning Your Kotlin Adventure Say hello to Kotlin Awesome Kotlin examples Dealing with Kotlin code Kotlin Playground Android Studio Configuring Kotlin for the project Using Kotlin in a new Android project Java to Kotlin converter (J2K) Alternative ways to run Kotlin code Kotlin under the hood The Kotlin standard library More reasons to use Kotlin Summary Laying a Foundation Variables Type inference Strict null safety Safe call Elvis operator Not-null assertion The let function Nullability and Java Casts Safe/unsafe cast operator Smart casts Type smart casts Non-nullable smart cast Primitive data types Numbers Char Arrays The Boolean type Composite data types Strings String templates Ranges Collections Statements versus expressions Control flow The if statement The when expression Loops The for loop The while loop Other iterations Break and continue Exceptions The try... catch block Compile-time constants Delegates Summary Playing with Functions Basic function declaration and usage Parameters Returning functions Vararg parameter Single-expression functions Tail-recursive functions Different ways of calling a function Default argument values Named arguments syntax Top-level functions Top-level functions under the hood Local functions Nothing return type Summary Classes and Objects Classes Class declaration Properties Read-write versus read-only Property access syntax between Kotlin and Java Increment and decrement operators Custom getters/setters The getter versus property default value Late-initialized properties Annotating properties Inline properties Constructors Properties versus constructor parameters Constructors with default arguments Patterns Inheritance The JvmOverloads annotation Interfaces Data classes The equals and hashCode methods The toString method The copy method Destructing declarations Operator overloading Object declaration Object expression Companion objects Companion object instantiation Enum classes Infix calls for named methods Visibility modifiers The internal modifier and Java bytecode Sealed classes Nested classes Import aliases Summary Functions as First-Class Citizens Function types What is function type under the hood? Anonymous functions Lambda expressions The implicit name of a single parameter Higher-order functions Providing operations to functions Observer (Listener) pattern A callback after a threaded operation Combination of named arguments and lambda expressions The last lambda in an argument convention Named code surrounding Processing data structures using LINQ style Java SAM support in Kotlin Named Kotlin function types Named parameters in function types Type alias Underscore for unused variables Destructuring in lambda expressions Inline functions The noinline modifier Non-local returns Labeled returns in lambda expressions Crossinline modifier Inline properties Function references Summary Generics Are Your Friends Generics The need for generics Type parameters versus type arguments Generic constraints Nullability Variance Variance modifiers Use-site variance versus declaration-site variance Collection variance Variance producer/consumer limitation Invariant constructor Type erasure Reified type parameters The startActivity method Star-projections Type parameter naming convention Summary Extension Functions and Properties Extension functions Extension functions under the hood No method overriding Access to receiver elements Extensions are resolved statically Companion object extensions Operator overloading using extension functions Where should top-level extension functions be used? Extension properties Where should extension properties be used? Member extension functions and properties Types of receivers Member extension functions and properties under the hood Generic extension functions Collection processing The Kotlin collection type hierarchy The map, filter, and flatMap functions The forEach and onEach functions The withIndex and indexed variants The sum, count, min, max, and sorted functions Other stream processing functions Examples of stream collection processing Sequence Function literals with a receiver Kotlin standard library functions The let function Using the apply function for initialization The also function The run and with functions The to function Domain-specific language Anko Summary Delegates Class delegation The Delegation pattern Decorator pattern Property delegation What are delegated properties? Predefined delegates The lazy function The notNull function The observable delegate The vetoable delegate Property delegation to the Map type Custom delegates View binging Preference binding Providing a delegate Summary Making Your Marvel Gallery Application Marvel Gallery How to use this chapter Making an empty project Character gallery View implementation Network definition Business logic implementation Putting it all together Character search Character profile display Summary

Similar books

Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36

2010 · PDF

THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.

1858 · PDF

Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.

2022 · PDF

The travels of Capts. Lewis and Clarke from St. Louis, by way of the Missouri and Columbia rivers, to the Pacific ocean; performed in the years 1804, 1805 & 1806, by order of the government of the United States. Containing delineations of the manners, customs, religion, &c. of the Indians, comp. from various authentic sources, and original documents, and a summary of the Statistical view of the Indian nations, from the official communication of Meriwether Lewis. Illustrated with a map of the country, inhabited by the western tribes of Indians

1809 · PDF

Professional Linux kernel architecture ''Wrox programmer to programmer''--Cover. - ''What you are reading right now is the result of an evolution over more than seven years: After two years of writing, the first edition was published in German by Carl Hanser Verlag in 2003. It then described kernel 2.6.0. The test was used as a basis for the low-level design documentation for the EAL4+ security evaluation of Red Hat Enterprise Linux 5, requiring to update it to kernel 2.6.18 (if the EAL acronym does not mean anything to you, then Wikipedia is once more your friend). Hewlett-Packard sponsored the translation into English and has, thankfully, granted the rights to publish the result. Updates to kernel 2.6.24 were then performed specifically for this book''--P. ix

2008 · PDF