From the course: Android Studio Essential Training 2020
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Challenge: Extract code to a new class
From the course: Android Studio Essential Training 2020
Challenge: Extract code to a new class
(upbeat electronic music) - [Instructor] Here's a simple challenge to test your understanding of how to modify code in Android Studio. First, create a new Android Studio project, and I'll use a template I haven't used before in this course. It'll be based on an activity template labeled Scrolling Activity. I'll name the new project Scrolling Activity, and then create it. When this project opens, you'll see the Scrolling Activity class. Now here's the very simple goal. That there's a bit of code in the onCreate function. Your job is to extract that code and place it into its own function. Call the function InitLayout. When you're done, you should have a new function named InitLayout that has all this code, and you should also have a call to that new function in the onCreate function. Don't do this manually, use Android Studio's refactoring tools to extract the code to a new function. When you're done, take a…
Contents
-
-
-
-
-
-
-
-
(Locked)
Create new Kotlin and Java code files3m
-
(Locked)
Edit code files in the editor window3m 15s
-
(Locked)
Useful code editing shortcuts4m 49s
-
(Locked)
Refactor and inspect code3m 6s
-
(Locked)
Create and use live templates3m 32s
-
Edit layouts with design and text mode3m 36s
-
(Locked)
Add MotionLayout to an XML layout file2m 2s
-
(Locked)
Animate views in the Motion Editor4m 56s
-
(Locked)
Challenge: Extract code to a new class1m 8s
-
(Locked)
Solution: Extract code to a new class2m 12s
-
(Locked)
-
-
-
-