contact: 
Uki D. Lucas

Recent site activity

106a. MenuCommons class: SMS agent

  • create a new class MenuCommons
  • define integers that will represent each Menu tab
  • define text strings that will serve as labels on the tabs
  • create a constructor for the class that will take Activity that calls the Menu
  • we will use the activity short name to identify on which screen we are


package com.chicagoandroid.sms;


import android.app.Activity;

import android.content.Intent;

import android.util.Log;

import android.view.Menu;

import android.view.MenuItem;

import android.widget.Toast;


public class MenuCommons

{

static final int MENU_0_MAIN = Menu.FIRST;

static final int MENU_1_CONTACT_INFO = Menu.FIRST + 1;

static final int MENU_2_ABOUT_US = Menu.FIRST + 2;


static final String MENU_LABEL_ABOUT_US = "ABOUT AUTHORS";

static final String MENU_LABEL_CONTACT_INFO = "CONTACT INFO";

static final String MENU_LABEL_MAIN = "HOME";


public MenuCommons(Activity activity)

{

this.activity = activity;

this.activityName = activity.getClass().getSimpleName();

}


private Activity activity;

private String activityName;