Part 3: Reformatting Code

Clean. Nice. Neat.

Android Developers often work with code, and lots of it. When writing lots of code, it's important for it to be understandable by humans. After all, we're all humans, and chances are that someone else will at some point look at your code. And you want it to look well-formatted. How can we do that?

Windows & Linux: Control+Alt+L

Take code from this:

package com.example.listoffriends

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        setSupportActionBar(toolbar)
val friends = mutableListOf<Friend>()
for (i in 1..100) {
    friends.add(Friend("Daniel", "Malone", 25))
}
    }
}

...to this:

package com.example.listoffriends

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        setSupportActionBar(toolbar)
        val friends = mutableListOf&lt;Friend&gt;()
        for (i in 1..100) {
            friends.add(Friend("Daniel", "Malone", 25))
        }
    }
}

This keyboard shortcut manages spacing and indentation. Make use of it!

Part 4: Entering Enter

More Tutorials

Android Basic Alert Dialog Box
Basic CardView

Basic CardView

Material Design.

Rounded Corners with a Border
Rounded Button in Android Studio

Rounded Button in Android Studio

Create beautiful buttons in XML.

RecyclerView Day 3: Invoicing app

RecyclerView Day 3: Invoicing app

Built with Android Studio and Kotlin.

Build a Ridesharing Android App - Part 1

Build a Ridesharing Android App - Part 1

Getting started is sometimes the hardest part.

setOnClickListener

Add a click listener in Kotlin.

Android Login Layout

Let users sign in.

Registration Screen

Registration Screen

It always begins with registration.