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

Simplify Your Android Development with XML

Simplify Your Android Development with XML

These slides provide a comprehensive overview of Android development using XML, beginning with an introduction and the speaker's background. They delve into Android's history, key concepts like Views and ViewGroups, and essential components like Activities and Intents. The presentation also explores advanced topics such as Styles, Themes, and RecyclerViews, offering practical insights and code examples. Overall, these slides equip developers with the foundational knowledge and practical guidance to simplify and enhance their Android development process using XML.

Fachridan Tio Mu'afa

December 25, 2024
Tweet

More Decks by Fachridan Tio Mu'afa

Other Decks in Programming

Transcript

  1. This work is licensed under the Apache 2.0 License Simplify

    Your Android Development With XML Fachridan Tio Mu’afa Software Engineer - Android Nusantara Beta Studio (NBS)
  2. This work is licensed under the Apache 2.0 License Fachridan

    Tio Mu’afa Latest Work Experiences: • Software Engineer - Android, NBS 2024 - Present • Android Developer, Amanah Corp. 2023 - 2024 • Android Developer, Fishku Indonesia 2022 - 2023 • Mobile Development (Android) Mentor 2023 - 2024 • Mobile Development (Android) Instructor & Advisor 2024 - Present Education: • UIN Syarif Hidayatullah Jakarta 2019 - 2024 Bachelor of Computer Science Others • Discord Manager Lead, GoogleDevsID 2022 - Present • GDG Co-Organizer, GDG Jakarta 2023 - Present • GDSC Lead, UIN Syarif Hidayatullah 2021 - 2022 About Me
  3. This work is licensed under the Apache 2.0 License Android

    Native Timeline Reference: 10 years of Android Development: The Retrospective - Speaker Deck
  4. This work is licensed under the Apache 2.0 License Platform

    Version API level VERSION_CODE Android 15 35 VANILLA_ICE_CREAM Android 14 34 UPSIDE_DOWN_CAKE Android 13 33 TIRAMISU Android 12 31 S Android 11 30 R Android 10 29 Q Android 9 28 P Android 8.0 26 O Android 7.0 24 N Android 6.0 23 M Android 5.0 21 LOLLIPOP Android 4.4 19 KITKAT Android 4.1, 4.1.1 16 JELLY_BEAN
  5. This work is licensed under the Apache 2.0 License View

    attributes in XML android:<property_name>="@+id/view_id" android:id="@+id/btn_calculate" android:<property_name>="<property_value>" android:layout_width="match_parent" android:layout_height="wrap_content" android:<property_name>="@<resource_type>/resource_id" android:text="@string/calculate" android:textColor="@color/white" android:backgroundTint="@android:color/holo_red_dark"
  6. This work is licensed under the Apache 2.0 License ConstraintLayout

    • Acts as a default layout for new Android Studio project. • As a ViewGroup, ConstraintLayout offers flexibility for layout design. • Provides constraints to determine positions and alignment of UI elements.
  7. This work is licensed under the Apache 2.0 License Scroll

    View <ScrollView ... > <ConstraintLayout ...> </ConstraintLayout> </ScrollView> • Used to make your layout can be scrollable. • Note that a ScrollView can only have one direct child. • If you have list inside ScrollView, use NestedScrollView instead.
  8. This work is licensed under the Apache 2.0 License Explicit

    Intent val moveIntent = Intent( this@MainActivity, DetailActivity::class.java ) startActivity(moveIntent)
  9. This work is licensed under the Apache 2.0 License Implicit

    Intent val phoneNumber = "081210841382" val dialPhoneIntent = Intent( Intent.ACTION_DIAL, Uri.parse("tel:$phoneNumber") ) startActivity(dialPhoneIntent)
  10. This work is licensed under the Apache 2.0 License Various

    Action of Implicit Intent val web = Intent( Intent.ACTION_VIEW, Uri.parse("http://www.bps.go.id") ) startActivity(web) val dialPhoneIntent = Intent( Intent.ACTION_DIAL, Uri.parse("tel:081210841382") ) startActivity(dialPhoneIntent) And many more … https://developer.android.com/guide/components/intents-common val maps = Intent( Intent.ACTION_VIEW, Uri.parse("geo:-7.053948,110.4318891,z=15")) startActivity(maps) val sms = Intent( Intent.ACTION_SENDTO, Uri.parse("smsto:0831") ) sms.putExtra("sms_body", "Hello, how are you?") startActivity(sms)
  11. This work is licensed under the Apache 2.0 License Using

    Styles <Button android:id="@+id/btn_calculate" android:text="@string/calculate" style="@style/MyButton" /> <style name="MyButton"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">wrap_content</item> <item name="android:textColor">@color/white</item> <item name="android:margin">16dp</item> <item name="android:padding">16dp</item> <item name="android:textSize">24sp</item> <item name="android:textStyle">bold</item> </style> Styles in themes.xml <Button android:id="@+id/btn_estimate" android:text="@string/estimate" style="@style/MyButton" />
  12. This work is licensed under the Apache 2.0 License Material

    3 Color Roles In general, a Theme should consist of five essential color groups with the role assignments are: • Primary • Secondary • Tertiary • Neutral • Neutral Variant Learn more: https://m3.material.io/styles/color/roles On Primary Primary Secondary On Secondary
  13. This work is licensed under the Apache 2.0 License Create

    your custom Material 3 Theme Custom Material 3 Builder: https://m3.material.io/them e-builder#/custom
  14. This work is licensed under the Apache 2.0 License RecyclerView

    • A successor of the ListView component. • Has a light memory and good performance.
  15. This work is licensed under the Apache 2.0 License More

    about RecyclerView • Contains ViewHolder by default. • Easy animations for adding, updating, or removing items. • Support LayoutManager to change layout. • Support vertical and horizontal scrolling. • Can be used together with DiffUtil.
  16. This work is licensed under the Apache 2.0 License RecyclerView

    Components • DataSource — ArrayList or List that contain set of data to be displayed • Adapter — connects data to the RecyclerView • Layout Item — XML file for one row of item • ViewHolder — has view information for displaying one item • LayoutManager — handles the organization of UI components in a View
  17. This work is licensed under the Apache 2.0 License Demo

    Let’s head over to our Android Studio! RecyclerView - Case Study Demo Link: https://github.com/fachridantm/RecyclerView
  18. This work is licensed under the Apache 2.0 License Let’s

    keep connected! THANK YOU fachridantm.me Deck is available at fachridantm.me/deck