It’s becoming a more and more common practice for Android apps to have a “main menu” or home Activity of some sort. The Facebook and Twitter apps both use a series of icons on a dashboard of sorts. Other apps, such as Survivor, use a list menu. All of these allow the user to quickly jump back to a list of a common tasks/sections within an app while avoiding wasting screen space and keeping the menu button free to create menus that are specific to the current activity (as they should be). But, how do you implement this?

At first, it might seem tricky to implement something like this in Android because a user might be several Activities away from a menu. Fortunately, it’s extremely easy to implement a main menu in Android. Here’s a quick example:

ImageView headerLogo = (ImageView) findViewById(;
headerLogo.setOnClickListener(new OnClickListener() {
	public void onClick(View v) {
		Context context = v.getContext();
		Intent intent = new Intent(context, MainMenuActivity.class);

Yup, that’s all there is to it. In this example, we’re grabbing a header image ( and assigning an OnClickListener. The OnClickListener simply starts a new Activity, but it includes the special flag FLAG_ACTIVITY_CLEAR_TOP. Basically, this will finish all Activities on top of the MainMenuActivity, jumping back to that Activity regardless of where the user is in the app.