title: actionbar button that call an activity
body: <p>the image on the main screen are buttons that call an activity is it possible that the button on the action bar can call the same activity as the button on the main screen..what kind of button should i make so that it can call the activity....i declared the action bar in the menu layout if it help to determine how i made the action bar..the problem is the button to be used so it can call an activity..</p>
  
  <p>this is my menu xml file
      
      </p>
  
  <pre><code>&lt;item 
      android:id="@+id/open" 
      android:showAsAction="ifRoom|withText" 
      android:title="open" 
      android:icon="@drawable/ic_action_open" 
      android:menuCategory="secondary"&gt;&lt;/item&gt;
  &lt;item 
      android:id="@+id/save" 
      android:showAsAction="ifRoom|withText" 
      android:title="Save" 
      android:icon="@drawable/ic_action_save"&gt;&lt;/item&gt;
  &lt;item 
      android:id="@+id/close" 
      android:showAsAction="ifRoom|withText" 
      android:title="Close" 
      android:icon="@drawable/ic_action_close"&gt;&lt;/item&gt;
  &lt;item 
      android:id="@+id/history" 
      android:showAsAction="ifRoom|withText" 
      android:title="History" 
      android:icon="@drawable/ic_action_history"&gt;&lt;/item&gt;
  &lt;item 
      android:id="@+id/settings" 
      android:showAsAction="ifRoom|withText" 
      android:title="Settings" 
      android:icon="@drawable/ic_action_settings"&gt;&lt;/item&gt;
  
  
  &lt;/menu&gt;
  </code></pre>
  
  <p>my .java file</p>
  
  <pre><code>package name.brucephillips.actionbarexample;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.MenuItem;
  import android.view.View;
  
  public class ActionBarExampleActivity extends Activity {
  /** Called when the activity is first created. */
   @Override
      public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      }
      public void sample (View v)
        {
      Intent intent = new Intent(getApplicationContext(), Sample.class); 
      startActivity(intent);
      }
      public void sample1(View v)
      {
      Intent intent = new Intent(getApplicationContext(), Sample1.class); 
      startActivity(intent);
      }
       public void sample2(View v)
      {
      Intent intent = new Intent(getApplicationContext(), Sample2.class); 
      startActivity(intent);
      }
      public void sample3(View v) {
      Intent intent = new Intent(getApplicationContext(), Sample3.class);
      startActivity(intent);
      }
  
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
         switch (item.getItemId()) {
              case R.id.sample:
              startActivity(new Intent(getApplicationContext(), Sample.class));
              break;
              case R.id.sample1:
              startActivity(new Intent(getApplicationContext(), Sample1.class));
              break;
              case R.id.sample2:
              startActivity(new Intent(getApplicationContext(), Sample2.class));
              break;
              case R.id.sample3:
              startActivity(new Intent(getApplicationContext(), Sample3.class));
              break;
      }
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p>and this is my main xml
      
      
  
  <pre><code>android:orientation="vertical"&gt;
  
   &lt;ImageView
   android:id="@+id/sample"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:onClick="sample"
   android:src="@drawable/ic_action_close" /&gt;
  
  &lt;ImageView
  android:id="@+id/sample1"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:onClick="sample1"`enter code here`
  android:src="@drawable/ic_action_history" /&gt;
  
  &lt;ImageView
  android:id="@+id/sample2"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:onClick="sample2"
  android:src="@drawable/ic_action_open" /&gt;
  
  &lt;ImageButton
  android:id="@+id/sample3"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:onClick="sample3"
  android:src="@drawable/ic_action_save" /&gt;
  
  
  
  &lt;/LinearLayout&gt;
  </code></pre>