Leave a rating/review
Android Studio a powerful IDE that helps you write code, debug, and test your app. It lets you know when you made a mistake. It provides code completion in a way that serves as documentation and keeps track of a variety of things to make Android development easier for you.
Using Android Studio can be a little overwhelming. Thankfully, Android Studio is highly configurable. If you’ve been following along with the learning path, you should feel comfortable working with Android Studio. The next step is to customize it to the way you want to work.
The MainActivity.kt file is a Kotlin source code that is also open as shown by the tabs.
Above the tabs is a navigation bar that allows you to switch between your various project files. This is a quick easy way to navigate between your files.
If you do want to see your Project files, open the Project tab. This is another way to navigate through all your resources. By default, the Project tab is set to show all your Android files. It has other options which you can switch depending on your preference.
Click the test subsection in the project tab
You can also change it to show just your tests. For now, keep it set to the Android view.
You have lots of different tool windows that provide a variety of different options. For instance, the Bookmarks tab allows you to bookmark frequently accessed files. Click on the tab and you’ll see that by default, the tab tracks your breakpoints and bookmarks if they’re present. Now, open MainActivity.kt. Navigate down the file and press F11 on Windows or F3 on macOS. This adds a bookmark to the line in question and also adds a bookmark icon next to the line that you bookmarked. You’ll see it listed in the Bookmarks tab. You can also use it to keep track of your files.
Click the plus sign to create a new list and call it activities. Now right-click the MainActivity.kt** file on the project structure and select Bookmarks then Add to Bookmarks. Select your list. Now, you have another way to track your files.
At the very bottom, you have the following tool window tabs:
- Version Control - Allows you to view your version control history.
- Profiler - Allows you to profile your app. This is useful for debugging performance issues. This provides metrics on how your app is using the CPU, memory, and energy. You can use these metrics to optimize your app.
- Logcat - This shows all your log messages. It is especially useful for debugging errors as they arise. You’ll be using this tool throughout the course.
- App Quality Insights - Allows you to view your app quality insights. This enables you to crashes detected by Firebase Crashlytics inside your Android Studio. You also see the crash stack trace and the line of code which has the issue and you can easily navigate to that line from here.
- Build - Shows the build output. This is useful for debugging build errors.
- TODO - Shows all your TODO items. This is useful for keeping track of things you need to do.
- Problem - Shows all the problems in your project. This is useful for keeping track of errors and warnings in your project.
- Terminal - Allows you to run terminal commands. This is useful for running commands like git or adb.
- App Inspection - Allows you to inspect your app. This is useful for debugging your app. It allows you to inspect your WorkManger jobs, database and network requests. For the database, you can see the data in your database and you can also run queries with the data. For network requests, you can see the network requests and their JSON responses. And for WorkManager, you can see the jobs and their status. These are very helpful for you to debug and check issues on your app.
Next, open up the Structure tab. Depending on your display resolution, this tab might be partially hidden. This tab allows you to see all the various methods and properties available to the object. Open MainActivity.kt and add the following method:
fun myTestMethod() {
println("Hello!")
}
Now check out the structure tab. You’ll see your new method and clicking on the method name will jump to the method definition. Clicking on the icon that shows the inherited button reveals all the inherited methods as well. And like your own code, clicking on the method jumps to the code.
When you’re working, you’d only want to see the tool tabs that you’re using. For instance, you can typically have a separate terminal window open so you don’t need a terminal tab. To get rid of it, right-click on the tab and select Remove from Sidebar.
If you ever close a tool tab, you can always get them back from the View menu. For instance, let’s say you want the terminal tab back again. Simply click the View menu and under Tool Windows, select the Terminal window and you’ll get it back again.
When writing code, it’s helpful to get all the tools out your way so you can focus on your code. To do this, just double-click the source code tab. Now, you can focus on your code and when you want to go back, double-click it again.
Android Studio also provides alternative viewing options. In the View menu, go to Apperance and click Enter Presentation Mode. This mode minimizes the UI and increases the font sizes making it ideal for presentations. You can access your tools through shortcuts. If you need to access the menu bar, just drag your cursor to the top of the screen. To exit presentation mode, click view exit presentation mode.
Finally, you can enter Full Screen mode which removes the menu bar. Like the others, simply move the cursor to the top of the screen to access the menu bar and click View / Appearance / Exit Full Screen to leave.
Finally, you can fully configure the editor by clicking the File / Settings or Preferences / Settings on macOS. YYou can change it to use one of the provided themes. You can also install different themes to match your preference.
You can also tweak all various aspects of the editor from the settings menu.