|
Pro Android with Kotlin@de android telegram Pro Android with Kotlin Developing Modern Mobilexxv
Introduction
Chapters
8
and
9
deal with APIs you can use in your app and user interface issues. Because
both of these are big issues, it is not possible to mention everything that refers to these
topics. I, however, will give you a selection of useful and interesting solutions for various
tasks in these areas.
Chapters
10
and
11
take a deeper look at development and building strategies and describe
how things can best be done inside Kotlin. While in the previous chapters the Kotlin code is
presented in a more empirical way, in Chapter
10
I describe how to use Kotlin constructs to
produce more elegant and better-readable application code.
Chapter
12
describes some methods you can use to communicate between components
inside your app or between your app and other apps or the outside world.
Chapter
13
handles different devices from a hardware perspective, including smartphones,
wearables like smartwatches, Android TV, and Android Auto. Here I also talk about ways to
access the camera and sensors and how you can interface with phone calls.
Chapters
14
to
17
deal with testing, troubleshooting, and publishing your app, and Chapter
18
explains how to use the tools provided with the SDK installation (part of Android Studio).
Some Notes About the Code
While in general I try to follow a “clean code” approach for all the code presented in this
book, for simplicity I use two anti-patterns you shouldn’t follow in your production code.
I do not use localized string resources. So, whenever you see something
like this inside XML resources:
android:text = "Some message"
what instead you should do is create a string resource and let the
attribute refer to it, as shown here:
android:text = "@string/message"
For logging statements, I always use
LOG
as a tag, as shown here:
Log.e("LOG", "The message")
In your code, you instead should create a tag like this:
companion object {
val TAG="The class name"
...
}
and then use this:
Log.e(TAG, "The message")
|
|
|