Pro Android with Kotlin



Yüklə 4,6 Kb.
Pdf görüntüsü
səhifə214/231
tarix29.11.2023
ölçüsü4,6 Kb.
#138831
1   ...   210   211   212   213   214   215   216   217   ...   231
@de android telegram Pro Android with Kotlin Developing Modern Mobile



261
© Peter Späth 2018 
P. Späth, 
Pro Android with Kotlin

https://doi.org/10.1007/978-1-4842-3820-2_10
Chapter
10
Development
This chapter covers issues closer to development matters, compared to the previous 
chapters. The topics we will be talking about here are less tightly coupled to specific Android 
OS APIs. It is more our concern here to find out how technical requirements can best be 
accomplished using Kotlin methodologies.
The chapter also has a section that covers transcribing Kotlin code to JavaScript code that 
can serve 
WebView
widgets.
Writing Reusable Libraries in Kotlin
Most tutorials you will find on the Web are about activities, services, broadcast receivers, 
and content providers. These components are reusable in the sense that you can more or 
less easily extract them from a project and copy them to another project. The encapsulation 
in the Android OS has reached an elaborate stage, which makes this reuse possible. On a 
lower level, however, in some cases the libraries or APIs that are provided inside Android 
might not suit all your needs, so you might be tempted to develop such libraries yourself and 
then copy the sources from project to project wherever feasible.
Surely, such a copying on the source code level does not fit well into modern methodologies 
for reusable libraries; just think about maintenance and versioning issues that introduce a 
lot of boilerplate efforts. The best thing is to design such reusable libraries as dedicated 
development artifacts. They then can be easily reused from different projects.
In the following sections, we develop a rudimentary regular expression library, serving as a 
conceptual basis for your own library projects.
Starting a Library Module
Library projects are projects containing one or more modules. With Android Studio open, 
create a new project and make sure it has Kotlin support enabled. Then, inside the new 
project go to New 

New module and choose Android Library.



Yüklə 4,6 Kb.

Dostları ilə paylaş:
1   ...   210   211   212   213   214   215   216   217   ...   231




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə