Pro Android with Kotlin


xx About the Technical Reviewers



Yüklə 4,6 Kb.
Pdf görüntüsü
səhifə14/231
tarix29.11.2023
ölçüsü4,6 Kb.
#138831
1   ...   10   11   12   13   14   15   16   17   ...   231
@de android telegram Pro Android with Kotlin Developing Modern Mobile

xx
About the Technical Reviewers
He currently works as the chief information security officer (CISO) for Cargotec Oyj and is a 
member of the ISACA Finland Chapter board.
Massimo has reviewed more than 45 IT books for different publishing companies and is 
the coauthor of 
Pro JPA 2 in Java EE 8
(Apress, 2018), 
Beginning EJB in Java EE 8
(Apress, 
2018), and 
Pro Android Games
(Apress, 2015).


xxi
Introduction
The programs explained in this book, despite their strong affinity to the Kotlin way of 
thinking, will not be totally mysterious to Java developers or developers of other modern 
computer languages. One of the design goals of Kotlin is expressiveness, so understanding 
Kotlin programs requires little effort, even when the programs get shorter. But at some point, 
you have to pay for maximum brevity with a loss of expressiveness and a loss of readability.
When it comes to deciding what is better, I favor expressiveness over brevity, but be assured 
that a loquacious programming style is a no-go. In the end, professional developers want to 
write concise apps because less code means lower costs when it comes to maintenance.
The Transition from Java to Kotlin
Just to whet your appetite, you will now take a look at a really simple app—one that lacks 
a lot of features you would want to see in a more complex and professional app—and then 
rewrite it from Java to Kotlin. The app consists of a single activity and presents an edit field, 
a button, and a text field that reacts to button presses.
If you want to create it using Android Studio, you initiate a new project, disable Kotlin support, 
and edit the layout to contain a 
TextView
widget, a 
Button
widget, and an 
EditText
widget. 
Then assign the IDs 
edit

btn
, and 
text
to them, respectively. The Java code is as follows:
package de.pspaeth.simplejava;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.*;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);



Yüklə 4,6 Kb.

Dostları ilə paylaş:
1   ...   10   11   12   13   14   15   16   17   ...   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ə