Android Bootcamp [Day 3]

Today I’m working thru the Your First Kotlin Android App: An App From Scratch which can be found on Kodeco’s website.

When you have a slider you can use inclusive range by only using two dots between two numbers

Also 32.sp is 32 scale points, a font size measurement.

Making text Bold is easy, add fontWeight = FontWeight.Bold to a Text.

You can easily wrap a component in a Row, Column or a Container by clicking on the component and then on the lightbulb icon next to it, then surround with widget, then select the component you want to use.

You can make text clickable by adding clickable as a modifier.

DP is Density Independent Pixel, best unit for layout.

You can select text and then drag that text to move it, in Android Studio.

You can put modifier = Modifier.weight(1f) to tell a Slider to take up the remaining space.

You can quickly extract strings to the string file inside of the lightbulb actions.

Logcats window is where debug statements come from, using println("{string}").

Use var alertIsVisible: Boolean by remember { mutableStateOf(false) } to store boolean that defaults to false.

Example lambda parameter: onDismiss: () -> Unit. This is a function that takes no arguments, and returns void.

If you wanna reformat the code in Android Studio, you can do so from the Code Menu -> Reformat Code.

If you wanna make a Dialog you can do so with AlertDialog.

When creating computed values val is used, also used for constants.

It shows how to use string interpolation inside of a string resource. Example %1$d. %1 takes the first argument after the resource, and the $d denotes that it is a decimal.

It also talks about how remember doesn’t save state when you rotate the device. Use rememberSaveable.

Type comp + ENTER to use the snippet to create a new composable function.