Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The application context is the central location for all top-level application functionality. You use the application context to access settings and resources shared across multiple activity instances.
You can retrieve the application context for the current process by using the getApplicationContext() method, like this:
Context context = getApplicationContext();
Because the Activity class is derived from the Context class, you can use the this object instead of retrieving the application context explicitly when you’re writing code inside your Activity class.
Once you retrieve a valid application context, you can use it to access application-wide features and services.
You can retrieve application resources by using the getResources() method of the application context. The most straightforward way to retrieve a resource is by using its unique resource identifier, as defined in the automatically generated R.java class. The following example retrieves a String instance from the application resources by its resource ID: