Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The New Era of Android Development - IDCamp x K...

The New Era of Android Development - IDCamp x Kadin 2023

Presented for Offline Training Android Dev @Medan

Ahmad Arif Faizin

May 28, 2023
Tweet

More Decks by Ahmad Arif Faizin

Other Decks in Programming

Transcript

  1. Device Mirroring 🪞 • File > Settings > Tools >

    Device Mirroring • Enable mirroring of physical Android devices. • Bye bye Visor~
  2. Kotlin DSL 🪶 • All in one language • More

    readable • Better compile-time checking
  3. Version Catalog 📖 // build.gradle.kts plugins { alias(libs.plugins.com.android.application) alias(libs.plugins.org.jetbrains.kotlin.android) id("com.google.devtools.ksp")

    } ... dependencies { implementation(libs.core.ktx) implementation(libs.appcompat) } // libs.version.toml [versions] com-android-application = "8.1.0-alpha11" org-jetbrains-kotlin-android = "1.8.0" core-ktx = "1.9.0" appcompat = "1.4.1" [libraries] core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "core-ktx" } appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } [plugins] com-android-application = { id = "com.android.application", version.ref = "com-android-application" } org-jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "org-jetbrains-kotlin-android" }
  4. Jetpack Compose is Android’s recommended modern toolkit for building native

    UI. It simplifies and accelerates UI development on Android. Quickly bring your app to life with less code, declarative Kotlin APIs, powerful tools, and backward compatible.
  5. XML Vs Compose 💥 <!-- activity_main.xml --> <FrameLayout> <RecyclerView android:id=”@+id/listNews”

    ... /> <TextView android:id=”@+id/textError”.../> </FrameLayout> // Activity.kt val listNews = findViewById(R.id.listNews) val textError = findViewById(R.id.textError) if (data.size > 0){ listNews.visibility = View.VISIBLE textError.visibility = View.GONE } else { listNews.visibility = View.GONE textError.visibility = View.VISIBLE } // Activity.kt @Composable fun NewsScreen(newsList: List<News>) { if (newsList.size > 0){ Column { for (title in newsList){ Text(text = title) } } } else { Text(text = "No Data!") } }
  6. “All you need is the plan, the road map, and

    the courage to press on to your destination.” Earl Nightingale