I\'m working on a code as a reference and encountered this Intent call: Intent(getApplicationContext(), secondActivity.class)
I got baffled because in my pr
"This provides a convenient way to create an intent that is intended to execute a hard-coded class name, rather than relying on the system to find an appropriate class for you." source: http://developer.android.com/reference/android/content/Intent.html#Intent%28android.content.Context,%20java.lang.Class%3C?%3E%29
getApplicationContext() : Returns the context for the entire application (the process all the Activities are running inside of). Use this instead of the current Activity context if you need a context tied to the lifecycle of the entire application, not just the current Activity.
There is an excellent writeup in the first answer :
What's the difference between the various methods to get a Context?
What’s Context exactly? Per the Android reference documentation, it’s an entity that represents various environment data. It provides access to local files, databases, class loaders associated to the environment, services including system-level services, and more. Throughout this book, and in your day-to- day coding with Android, you’ll see the Context passed around frequently. From: "Android in Practice" book.