LibCoder

Tiny Android Projects Using Kotlin

1C Agda Kotlin
Tiny Android Projects Using Kotlin
Дата выхода: 2024
Количество страниц: 384
Размер файла: 3,7 МБ
Тип файла: PDF
Добавил: LibCoder
Оглавление
Cover....1 Half Title....2 Title Page....4 Copyright Page....5 Table of Contents....6 Preface....14 About the Authors....17 Chapter 1: Introduction and Getting Started....18 1.1 Introduction to Kotlin....18 1.2 The Benefits of Kotlin....20 1.2.1 Kotlin’s Code Is Concise....21 1.2.2 Kotlin Offers More Safety....21 1.2.3 Kotlin Multiplatform....21 1.2.4 Kotlin is Open Source....22 1.3 Android application development with Kotlin....22 1.4 The Android Operating System....22 1.4.1 Android as Open Source....23 1.5 A functional Android Application....23 1.5.1 User Interface....23 1.5.2 Interactivity....25 1.5.3 Storage Options....27 1.5.3.1 Local Storage....27 1.5.3.2 Online Storage....28 1.6 Creating Your First Android Project....29 1.7 The Components of an Android Application....32 1.8 Summary....35 Chapter 2: Basic XML Widgets in Android....37 2.1 BMI Calculator Overview....37 2.2 Creating the User Interface of the App....39 2.2.1 Understanding ConstraintLayout....39 2.2.1.1 Understanding the Use of Constraints....41 2.2.1.2 Adding the App Title....41 2.2.1.3 Adding the Height Widgets....44 2.2.2 Adding the Weight Widgets....47 2.2.3 The Result View and the Calculate Button....50 2.3 The Activity and ViewBinding....50 2.3.1 Referencing Layout Views with ViewBinding in an Activity....52 2.4 Connecting Each Input Field with the Increment and Decrement Buttons....54 2.4.1 Getting the Value from Height Value....55 2.4.2 Getting the Weight Value....56 2.5 Calculate the BMI Result....57 2.5.1 The String Resource File....58 2.6 The Calculate Button....60 2.6.1 Testing and Running the App....61 2.7 Errors and the Logcat Window....61 2.8 Summary....63 Chapter 3: More on Android XML Views: Project 2 – Quiz App: Part 1....65 3.1 The Quiz App Overview....65 3.2 Creating the Welcome screen....66 3.2.1 Adding Images to Your Project in Android Studio....67 3.2.2 Designing the Welcome Screen....67 3.2.2.1 Using the Constraint Guideline....69 3.2.2.2 How to Use the MaterialCardView....71 3.2.2.3 Using Linear Layout as a Parent for Child Views....73 3.3 Preparing the Quiz Questions Activity....75 3.3.1 ProgressBar and Question Number TextView....77 3.3.2 Creating and Using Drawable in Android....79 3.3.3 A Mini Exercise on Drawable....82 3.4 Adding the Options View....83 3.5 The Result UI....86 3.5.1 Testing the Application....90 3.5.2 Dimens and Colors Value....91 3.6 Summary....93 Chapter 4: Intents in Android: Project 2 – Quiz App – Part 2....94 4.1 Introduction to Intents....94 4.1.1 Implicit Intent....96 4.1.2 Explicit Intent....97 4.2 Starting the Quiz Questions Activity....97 4.2.1 Context....99 4.2.2 Testing the Start Button....100 4.3 Preparing the Questions and Options....101 4.3.1 Defining a Data Class....101 4.3.2 Constants and Dummy Questions....102 4.3.3 MINI Exercise for the QuizQuestionActivity....105 4.4 Displaying the Questions and Options on the screen....106 4.4.1 Setting up the Questions....107 4.4.2 Choosing the Right or Wrong Answer....109 4.4.3 Adding Click Listeners to the Views....110 4.4.4 Testing the QuizQuestionActivity....114 4.5 Adding functionality to the ResultActivity....115 4.5.1 Testing the App....116 4.6 Summary....117 Chapter 5: Android Fragments and ViewPager2....119 5.1 Image Slider App Overview....119 5.2 Android ViewPager and ViewPager2 Explained....119 5.3 Preparing the Layout for the Image Slider....120 5.3.1 Android Third-Party Libraries....121 5.3.2 Adding the Widgets for the Image Slider Layout....122 5.4 An Introduction to Fragments....125 5.5 Pager Adapter and Its Component....129 5.6 Setting up ViewPager2 with PagerAdapter....130 5.7 The Lifecycle of an Activity and Fragment....134 5.7.1 The Activity....134 5.7.2 The Fragment....136 5.8 Making an Android Screen Scrollable....139 5.9 Summary....141 Chapter 6: Networking in Android Using Retrofit....142 6.1 The Weather App Overview....142 6.2 An Introduction to Android Networking....143 6.2.1 What You Need to Know About HTTP and REST APIs....144 6.2.1.1 HTTP Response Codes and Meaning....145 6.2.2 Making a Simple Network Call with Standard HTTP URL Connection Class....146 6.2.2.1 Getting Access to the Weather API....146 6.2.2.2 Main Thread vs Background Thread....148 6.2.2.3 Making Network Calls with HTTP URL Connection....148 6.2.2.4 A Basic Example Using the Executor Class....149 6.2.2.5 Fetching the Weather Response....151 6.2.2.6 Testing the HttpURLConection Code....152 6.3 Using the Android Location Service....153 6.3.1 Requestion User Permissions....153 6.3.2 Getting the Device Location....158 6.4 Using Retrofit to Simplify Networking....159 6.4.1 Mapping the JSON Response to a Kotlin Object....161 6.4.2 Replacing HttpURLConnection with Retrofit....164 6.4.2.1 Checking If the Device Is Connected to the Internet....165 6.4.2.2 Making the Network Call with Retrofit Callback....166 6.5 Simplifying Asynchronous Calls with Coroutine....168 6.5.1 Suspending Executions and Launching a Coroutine Operation....169 6.5.1.1 Testing the App....170 6.5.2 Using Coroutine with Retrofit....171 6.6 Displaying the Weather Information on the UI....172 6.6.1 Testing the App....174 6.7 Summary....175 Chapter 7: Google Firebase Services: Project 5 – Tour Guide App....176 7.1 The Tour Guide Application Overview....176 7.2 Introducing the Android Navigation component....177 7.2.1 Creating the Navigation Graph....178 7.2.2 Adding the NavHostFragment....182 7.2.3 Setting up the NavController....184 7.3 An Introduction to Google Firebase Services....185 7.3.1 Adding Your Project to Google Firebase....186 7.3.2 Project Level Dependencies....188 7.3.3 App-Level Dependencies....189 7.4 Firebase Authentication with Email and Password....189 7.4.1 Registering a User to Firebase Authentication....192 7.4.2 Implementing the Authentication Flow....193 7.4.2.1 Testing the Authentication process....197 7.5 Managing the Tour Images with Firebase Cloud Storage....197 7.5.1 Selecting Image from the Device....199 7.5.1.1 Testing the Image Upload and Retrieval from Firebase Storage....202 7.6 Saving and Reading Data with Firebase Firestore....203 7.6.1 Saving a Tour into Firestore....204 7.6.1.1 Testing the add tour feature to firestore....206 7.6.2 Fetching Data from Firestore....206 7.6.2.1 Testing the Read data from Firestore....207 7.7 Displaying a Dynamic List Using a Recyclerview....208 7.7.1 Adding the Recyclerview to the Tour Fragment Layout....209 7.7.2 Creating the Item Layout....210 7.7.3 Creating the Adapter and the ViewHolder....212 7.7.4 Binding the Adapter to the RecyclerVIew....214 7.7.5 Testing the Tour List Display on RecyclerView....215 7.8 Updating Existing Data in Firestore....215 7.8.1 Implementing a ClickListener within the Adapter....217 7.8.2 Send the Object to the Edit Screen....217 7.8.3 Receiving the Object and Displaying on the Screen....219 7.8.4 Implement the Update Method....220 7.8.5 Testing the Edit and Update Feature....221 7.9 Deleting Data from Firestore....221 7.9.1 Implementing the Delete Operation....223 7.9.2 Testing the Delete Operation....224 7.10 Summary....225 Chapter 8: Android MVVM Architecture: Project 5 – Tour Guide Part 2....226 8.1 The Android Architectural Patterns....226 8.1.1 MVC....227 8.1.2 MVP....227 8.1.3 MVVM....227 8.2 Refactoring the Tour Project....228 8.3 Refining the Data Layers....229 8.3.1 Lambda Expressions and Higher-order functions....229 8.3.2 Testing the Change in the Data Layer....235 8.4 The Presentation Layers....237 8.4.1 Adding MVVM to the App....238 8.4.2 Connecting the ViewModel to the UI Classes....242 8.4.2.1 Testing the Tour Display Feature....243 8.4.2.2 Testing the Delete state from the ViewModel....245 8.4.2.3 Testing the save And Update method refactor....248 8.5 Summary....249 Chapter 9: Basic Jetpack Compose Elements....250 9.1 Introduction to Jetpack Compose....250 9.1.1 Creating a New Compose Project....251 9.1.1.1 The MainActivity Class....251 9.1.1.2 The Greeting Composable....252 9.1.1.3 The Preview Feature....252 9.1.1.4 Lambda Expressions and Higher-Order Function in Jetpack Compose....253 9.1.2 Basic Compose Layouts....254 9.1.3 Element Decoration....254 9.1.3.1 Compose Modifier....256 9.1.4 Other Compose Layouts....257 9.1.4.1 The Box Layout....258 9.1.4.2 The Constraint Layout....259 9.2 Your First Compose Interface....259 9.3 Tip Calculator App Overview....261 9.4 Building the UI of the App....261 9.4.1 TextField....262 9.4.2 The Slider Widget....264 9.4.3 The Split Elements and Calculate Button....266 9.5 State in Jetpack Compose....269 9.6 Calculating the Tips Per Person....272 9.7 Summary....273 Chapter 10: More on Compose Elements....275 10.1 The Countdown Timer Project Overview....275 10.2 Creating the User Interface of the App....277 10.2.1 Preparing the Reusable Timer Field....279 10.2.1.1 Adding the Borders to the Timer Field....281 10.2.2 Creating the Start and Stop Button....284 10.2.2.1 Testing the App....285 10.3 Creating the Application State....285 10.3.1 Implementing the Countdown Timer Class....286 10.4 Connecting the States to the Timer Field....291 10.5 Making the Button Functional....294 10.5.1 Testing the App....295 10.6 Using rememberSaveable to Restore UI State....295 10.7 Summary....297 Chapter 11: Room Database with Jetpack Compose....298 11.1 The Wish List App Overview....298 11.1.1 Understanding the UI of the Application....299 11.1.1.1 A Walk-Through of the Starter Folder....299 11.1.1.2 Introducing the NEW Composables....300 11.2 The Scaffold Layout....300 11.3 Displaying a List of Items Using LazyColumn....304 11.4 Navigating Between Composables....306 11.4.1 Adding Navigation to the WishList App....306 11.4.1.1 Passing Data Between Composables....309 11.5 Saving Data Locally on Android....313 11.5.1 Introduction to Room Database....314 11.5.1.1 Adding Room Database to your project....316 11.6 Performing CRUD Operations in Room....317 11.6.1 Defining the DAOs....317 11.6.2 Creating the Room Database....318 11.6.2.1 Initializing the Database Using the DatabaseBuilder....319 11.6.2.2 The Application Class....320 11.7 Managing Compose State Using ViewModel....320 11.7.1 Observing the Data Items from Room....323 11.7.2 Inserting and Updating a Wish....325 11.7.3 State Hoisting vs. Single Source of Truth....329 11.7.4 The Database Inspector....329 11.7.5 Swipe to Delete a Wish From the List....330 11.8 Summary....333 Chapter 12: Menus and Navigation in Jetpack Compose....335 12.1 An Overview of the Music Android App....335 12.2 Introduction to Menus and Dialogs....336 12.2.1 The Navigation Drawer....337 12.2.2 How to Add a Bottom Bar....337 12.2.3 Using Actions for the TopAppBar....338 12.3 Understanding the Options Dialog....338 12.3.1 Alert Dialog....339 12.3.2 BottomSheet....340 12.4 Building the App....340 12.4.1 Setting Up the App’s Navigation Graph....341 12.4.1.1 Integrating the Drawer Menu....344 12.4.1.2 Identifying the Selected Destination....347 12.4.1.3 Adding the Bottom Menu....348 12.4.1.4 Identifying the Selected Item....349 12.5 Implementing the Menu Dialogs....351 12.6 Summary....357 Appendix....359 System Requirements for Android Studio....359 Download and Installation....359 Installation on Mac....361 The Android SDK....361 Creating a New Project and Setting Up the Test Devices....363 Getting Familiar with the Android Studio Main Window....366 Testing Devices for Your Android Application....367 Setting Up a Physical Device for Testing....373 Index....379

Описание

Коротко и по делу о том, что важно знать про android.

The "Tiny Android Projects Using Kotlin" book is an excellent resource for developers who want to learn how to build Android apps using the latest tools and frameworks. In today's fast-paced world, Android development is an ever-evolving field that requires regular updates to stay ahead of the latest trends and technologies. Kotlin is the preferred language for Android development, making this book a practical and hands-on guide to learning the language and creating high-quality Android apps.

The first chapter introduces the role of Kotlin and Android in software development today. The book consists of 12 chapters that take you through a step-by-step process of building practical Android apps using Kotlin, XML, and Jetpack Compose. You will learn about the advantages of using Kotlin over other programming languages for Android development and the fundamental components of an Android app.Chapter 2 dives into the application development process using common elements of XML and Android Activities. By the end of the chapter, readers will have built their first Android application project, which calculates the BMI of a person based on height and weight.

Through this project, they will learn about more XML elements and create more complex user interfaces. In Chapters 3 and 4, readers will embark on their second project, a quiz application. They will also learn how to navigate between Activity screens and apply logic to UI elements.

Chapter 5 introduces readers to fragments, a crucial component of Android UI design. Through this chapter, readers will learn how to create reusable UI components while building their third project, an onboarding screen for Android devices.

Finally, Chapter 6 takes readers through the process of building a weather application. This chapter introduces them to REST APIs, an essential aspect of many applications that allows them to connect to a server over the internet.

Если материал оказался полезен — сохраните страницу.

android chapter using kotlin will development learn readers

Частые вопросы

Можно ли скачать «Tiny Android Projects Using Kotlin» бесплатно?

Да, «Tiny Android Projects Using Kotlin» доступна для бесплатного скачивания на нашем сайте в формате PDF. Ссылка на файл находится на этой странице.

В каком формате и какого размера файл?

Книга предоставляется в формате PDF, размер файла 3,7 МБ.

Кто автор и когда вышла книга?

автор — Nwokike Loveth , Panjuta Denis, издательство CRC Press is an imprint of Taylor & Francis Group, LLC, год выпуска 2024, 384 страниц.

О чём книга «Tiny Android Projects Using Kotlin»?

In today's fast-paced world, Android development is an ever-evolving field that requires regular updates to stay ahead of the latest trends and technologies.

Похожие материалы