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.
Refactor and inspect code
From the course: Android Studio Essential Training 2020
Refactor and inspect code
- [Instructor] Android Studio has powerful refactoring capabilities letting you rename your IDs, move files around and extract code into new factors. I'll show you how to use some of these features in this project that I created from the empty activity template. First, I'll show you how to rename variables and functions really easily. In this function, I'll create a new local variable called myVar and I'll set its value to a literal string of hello from Android. And then I'll output that value to the logcat window with printlm. Now, let's say I want to rename that variable. I'll place my cursor in the variable name and then use the keyboard shortcut, shift, f6 and that's the same keyboard shortcut on both Mac and Windows. Now, with that little box that appears, I'll start typing the new name and notice that the reference for the variable changes at the same time. The same thing works for functions. I'll create 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)
-
-
-
-