
Second codelab/module I subscribed to is "Create your first Android app". Since I already had a short experience of uisng it, I breezed over some parts I already knew and tried to focus on the technnical aspect of "why" things worked in a certain way.
A project template provides the blueprint for a cetian type of app. For each template consists of files needed for Android Studio(AS) build the project. (In order to use Jetpack Compose pick the template with a cube box logo)!

For the package name, leave it as it is because that's just the name for organizing your file structure.
Minimum SDK indicates the minimum version of Android that your app can run on.
When you click finish, you will have a page called MainActivity.kt and another one called activity_main.xml. The codelab did have the xml page because they are using Jetpack Compose which is an Android UI toolkit introduced by Google.
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
GreetingsTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
Greeting("Android")
}
}
}
}
}
@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
Surface(color = Color.Yellow) {
Text(
text = "Hello! My name is $name!",
modifier = modifier.padding(64.dp)
)
}
}
@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
GreetingsTheme {
Greeting("Sungju")
}
}
Note that in the Greeting function in the second code block:
A Modifier is used to augment or decorate a composable. One modifier you can use is the padding modifier, which adds space around the element (in this case, adding space around the text). This is accomplished by using the Modifier.padding() function.

To run the code you will need to import the following:
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.sungju.greetings.ui.theme.GreetingsTheme
Also, the tutorial suggested that you should keep these in alphabetical order. You can easily do this buy clicking on 'Code' from the top tabs and then selecting 'Optimize Imports'.