title: How to inflate Menu in Activity
body: <p>I am trying to inflate a menu item in my main activity but i am unable to create menu in  the main activity.</p>
  
  <p>Here is my Java Code.</p>
  
  <pre><code>package in.webxstudio.classesfinal;
  
  import android.content.Intent;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuInflater;
  import android.view.View;
  import android.widget.ImageView;
  import android.widget.TextView;
  
  import com.bumptech.glide.Glide;
  
  import java.util.List;
  
  public class MainActivity extends AppCompatActivity {
  
  private static final String TAG = "MainActivity";
  
  private ImageView profile;
  private Intent intent;
  
  private TextView name,course,roll_no,total_lecture,lecture_attended,exams_conducted,exams_appeared,total_lessons,lessons_covered;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
  
      initializeVariables();
      profile=findViewById(R.id.profile_image);
      Glide.with(getApplicationContext()).asBitmap().load("https://i.imgur.com/cXuNKOA.jpg").into(profile);
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      MenuInflater inflater = getMenuInflater();
      inflater.inflate(R.menu.main_page_menu, menu);
  
      // return true so that the main_page_menu pop up is opened
      return true;
  }
  
  private void initializeVariables(){
      name=findViewById(R.id.student_name);
      course=findViewById(R.id.course);
      roll_no=findViewById(R.id.roll_no);
      total_lecture=findViewById(R.id.total_lecture_text);
      lecture_attended=findViewById(R.id.total_lecture_attended_text);
      exams_conducted=findViewById(R.id.exams_conducted_text);
      exams_appeared=findViewById(R.id.exams_appeared_text);
      total_lessons=findViewById(R.id.total_lessons_text);
      lessons_covered=findViewById(R.id.lessons_covered_text);
  }
  
  private void setData(List&lt;String&gt; personal,List&lt;String&gt; attendance,List&lt;String&gt; results,List&lt;String&gt; progress){
      name.setText(personal.get(0));
      course.setText(personal.get(1));
      roll_no.setText(personal.get(2));
      Glide.with(getApplicationContext()).asBitmap().load(personal.get(3)).into(profile);
  
      total_lecture.setText(attendance.get(0));
      lecture_attended.setText(attendance.get(1));
  
      exams_conducted.setText(results.get(0));
      exams_appeared.setText(results.get(1));
  
      total_lessons.setText(progress.get(0));
      lessons_covered.setText(progress.get(1));
  }
  
  private void gotoDestination(Class classname){
      intent=new Intent(this,classname);
      intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      startActivity(intent);
  }
  
  public void Attendance_Page(View v){
      gotoDestination(Attendance_report.class);
  }
  
  public void ResultPage(View v){
      gotoDestination(Result_report.class);
  }
  
  public void ProgressPage(View v){
      gotoDestination(Progress_Activity.class);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Here is my Xml code for menu</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;item
      android:id="@+id/settings_menu"
      android:title="@string/settings" /&gt;
  &lt;item
      android:id="@+id/log_out_menu"
      android:title="@string/log_out"/&gt;
  &lt;/menu&gt;
  </code></pre>
  
  <p>What else Should i do.?
  I have created onCreateOptionMenu() right below my Oncreate Method.
  Please Explain reason why my code is not working and what is wrong in my code</p>