title: How to show menu items automatically in android (without clicking menu button) when the layout is viewed.?
body: <p>How to show menu items automatically  in android (without clicking menu button) when the layout is viewed.? I am using this code but it is not working.</p>
  
  <pre><code>package com.sai.menu;
  
  import java.util.Timer;
  
  import java.util.TimerTask;
  
  import android.app.Activity;
  
  import android.os.Bundle;
  
  import android.view.ContextMenu;
  
  import android.view.Menu;
  
  import android.view.MenuInflater;
  
  import android.view.MenuItem;
  
  import android.view.View;
  
  import android.widget.Toast;
  
  public class ViewOptionsMenu extends Activity {
  
  /** Called when the activity is first created. */
  
  @Override
  
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      openOptionsMenu();
  
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      super.onCreateOptionsMenu(menu); 
      menu.add("Search");  
      menu.add("More");  
      return true;
  }
  
  @Override
      public boolean onPrepareOptionsMenu(Menu menu) {  
  
                closeOptionsMenu();
  
          return super.onPrepareOptionsMenu(menu);
      }
  
  
   }
  </code></pre>