Hi All,
I'm currently trying to create a basic action bar in my app. I'm trying to
override the *onCreateOptionsMenu *method in my Main Activity but am
getting an error that *"method does not override or implement a method from
a supertype". *However, I see in the 'Activity' class definition
(https://developer.android.com/reference/android/app/Activity.html) that it
does contain the method. So, please help me understand why i'm not able to
override the method?
Here's the MainActivity class code along with all the imports:
*import android.app.Activity;*
*import android.content.Intent;*
*import android.os.Bundle;*
*import android.view.Menu;*
*import android.view.MenuItem;*
*public class MainActivity extends Activity {*
* @Override*
* protected void onCreate(Bundle savedInstanceState) {*
* super.onCreate(savedInstanceState);*
* setContentView(R.layout.activity_main);*
* }*
* @Override*
* public boolean OnCreateOptionsMenu(Menu menu)*
* {*
* //Inflate the menu. this adds items to the action bar if it is present*
* getMenuInflater().inflate(R.menu.menu_main,menu);*
* return super.onCreateOptionsMenu(menu);*
* }*
* @Override*
* public boolean onOptionsItemSelected(MenuItem item)*
* {*
* switch(item.getItemId())*
* {*
* case R.id.action_create_order:*
* //Code to run when the create order item is clicked*
* Intent intent=new Intent(this,OrderActivity.class);*
* startActivity(intent);*
* return true;*
* case R.id.action_settings:*
* //Code to run when the settings item is clicked*
* return true;*
* default:*
* return super.onOptionsItemSelected(item);*
* }*
* }*
*}*
Thanks,
Guru
--
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-developers/eb939f5e-b89c-4506-991c-961e8023be99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.