What does it say is wrong?

On Apr 1, 12:07 am, Allan Ai <[email protected]> wrote:
> Why I cann`t run the following case? It says there are sth. wrong at
> "onCreateOptionsMenu","onOptionsItemSelected"&"onPrepareOptionsMenu" .
>
> package com.demo.menu;
>
> import android.app.Activity;
> import android.os.Bundle;
>
> public class MenuDemo extends Activity {
>     /** Called when the activity is first created. */
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.main);
>     }
>
> @Override
>  public boolean onCreateOptionsMenu(Menu menu) {
>   super.onCreateOptionsMenu(menu);
>   menu.add(0,0,0,"1");
>   menu.add(0,1,0,"2");
>   menu.add(0,2,0,"3");
>   menu.add(0,3,0,"4");
>   menu.add(0,4,0,"5");
>   return true;
>  }
>
> �...@override
>  public boolean onOptionsItemSelected(MenuItem item) {
>   super.onOptionsItemSelected(item);
>   TextView view = (TextView) findViewById(R.id.text_view);
>   switch (item.getItemId()) {
>   case 0:
>    view.setText("This is"+item.getTitle());
>    break;
>   case 1:
>    view.setText("This is"+item.getTitle());
>    break;
>   default:
>             view.setText("Debug.");
>   break;
>   }
>   return false;
>  }
>
> �...@override
>  public boolean onPrepareOptionsMenu(Menu menu) {
>   return super.onPrepareOptionsMenu(menu);
>  }
>
> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to