Launching Activities Using the Application Context
by, 02-11-2012 at 01:51 PM (1790 Views)
Call the startActivity() method of the application context. It is most commonly used to launch the activity. startActivity() method takes only one parameter which is called Intent. The below code shows a startActivity() method with an explicit intent.
In the above code, target activity is launched on request of intent, called MenuActivity. This MenuActivity class must be registered in Android manifest file as it is defined in application’s package.Java Code: This is the code to launch an activitystartActivity(new Intent(getApplicationContext(),MenuActivity.class));