Refactoring MainActivity to SubHunter
It is a good practice to use meaningful names for all the different parts of our code. We will see this as we progress through the projects. For now, I think MainActivity
is a bit vague and inconclusive. We could make do with it, but let's rename it to something more meaningful. This will also allow us to see how we can use the refactoring tool of Android Studio. The reason that we use the term "refactoring" instead of just "renaming" is that when we change the names we use in our code, there is often much more than just a simple name change going on behind the scenes. For example, later, when we refactor the MainActivity
filename to SubHunter
, Android Studio will change the name of the file as well as some code in the AndroidManifest.xml
file and the MainActivity.java
(which will soon be SubHunter.java
) file.
In the Project panel, right-click on the MainActivity
file and select Refactor | Rename. In the pop-up window...