Why we're still using MainActivity.java? although we have created another similar java file? used for portrait mode?
I watched the previous video in which we created another java file which forces the app to only stay in portrait mode on rotation, but I don't understand why we're writing our rest of the code in MainActivity.java why not write it in the portrait java file? the instructor said those both the files are doing the same work!
Thanks for your time.
Brad Wagner9,371 Points
For now, I'm only thinking of the InteractiveStoryApplication class's single purpose is to set the portrait mode as in setting the stage for all the Activities that we make henceforth. It is instantiated before any other class when the process for your application/package is created so it comes before any Activity class. Any Activity that we make from now on will be in portrait instead of having to set '<activity android:name=".MainActivity"> in each of their corresponding .xml manifest files. We can only do that with an Application class and not an Activity class (apply the portrait mode to affect all Activities in our package). We don't want to put all of our code in InteractiveStoryApplication so we can divvy up other functionality to other classes.