Hello World and Composable Previews in Android Studio
I've been using Android phones for several years now, and it has always been on my bucket list to write myself some productivity apps. This morning I thought I'd get reacquainted with Android app development.
The official Android developer documentation site has an excellent Hello World tutorial: https://developer.android.com/codelabs/basic-android-kotlin-compose-first-app
Following the tutorial, I was up and coding within minutes. Kotlin made the code quite readable, and Jetpack Compose's declarative approach removed a lot of the view setup boilerplate I remembered from years ago.
In under an hour I had a basic greeting card app built with a name customization feature:
On the right side of Android Studio, the design preview allowed me to see my composable GreetingPreview() rendered in realtime. GreetingPreview() is the function at the bottom which is annotated with @Preview and @Composable. That function is called a composable. Composables are the basic building blocks of UI in Jetpack Compose. A composable preview can be viewed in an Android Studio design pane without having to run the whole heavyweight emulator.
Comments
Post a Comment
Hey there, I just want to let you know that I read all comments, even if it takes days or weeks for me to switch my brain over from publishing mode to feedback-reading mode. Thanks for taking the time to write something. Your words mean a lot to me. Be gentle and kind - this is a space where I post my works-in-progress, good or bad, and it can be hard putting my art out there.