From the course: Android Studio Essential Training 2020
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Create new Kotlin and Java code files
From the course: Android Studio Essential Training 2020
Create new Kotlin and Java code files
- [Instructor] Android Studio makes it easy to add new Java and Kotlin code files to your project. Assuming you've created a project that already uses Kotlin, you can create a new Kotlin file or class by going to a package, right clicking, choosing New, and then Kotlin File/Class. You need to choose the kind of file that you want to create. If you use the default of file, you'll be creating a top level file where you can create functions that are available to the entire app. Or, you can create a class, and then just like Java, you're creating a class structure. I'll create a class named StringUtility. If your project is already integrated with Git, you'll be prompted to add the file to Git. And then you can start creating functions in the class. So, for example, I might create a function named getAString. And then I might set the return type as String. And then I'll have a return statement that says, "here's 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)
-
-
-
-