View RSS Feed

Android Development

Launching Activities Using the Application Context

Rate this Entry
by , 02-11-2012 at 12:51 PM (2399 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.


Java Code: This is the code to launch an activity
startActivity(new Intent(getApplicationContext(),MenuActivity.class));
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.

Submit "Launching Activities Using the Application Context" to Facebook Submit "Launching Activities Using the Application Context" to Digg Submit "Launching Activities Using the Application Context" to del.icio.us Submit "Launching Activities Using the Application Context" to StumbleUpon Submit "Launching Activities Using the Application Context" to Google

Comments