How do you know what menu you want?

You could start the activity by passing in some extra parameter with the intent.

>  public boolean onCreateOptionsMenu(Menu menu) {
>         MenuInflater inflater = getMenuInflater();
        if(getIntent.getBooleanExtra("second_menu",true))
>         inflater.inflate(R.menu.optionsmenu, menu);
        else
                inflater.inflate(R.meny.optonsSecondMenu, menu);
>         return true;
>     }


On Nov 25, 2011, at 10:03 AM, Kiran Kumar Kendole wrote:

> Thanks for the reply.
> I have two XMLs. And One Activity Class. there I used one XML like this.
>  public boolean onCreateOptionsMenu(Menu menu) {
>         MenuInflater inflater = getMenuInflater();
>         inflater.inflate(R.menu.optionsmenu, menu);
>         return true;
>     }
> 
> But it is showing the same options for all screens. Could you please let me 
> know how to use the second XML.
> 
> Thanks,
> KIRANKUMARKENDOLE
> 
> 
> On Fri, Nov 25, 2011 at 3:23 AM, Johan Rydenstam 
> <[email protected]> wrote:
> Several ways to do this. One solution is to have two XML files that defines 
> the different menus.
> 
> 
> On Nov 25, 2011, at 9:19 AM, Kiran Kumar Kendole wrote:
> 
>> Hi Guys,
>> 
>> I am trying to design a options menu. I tried it, working fine. But the 
>> problem , It is showing same options for all pages. 
>> My requriement is 
>> 
>> In Home Page ( I need only EDIT, DELETE,ATTACH options)
>> Second Page ( I need only BACK , HOME , EXIT  options).
>> 
>> Like I want some of the options for some pages. Please suggest me.
>> 
>> Thanks,
>> KIRANKUMARKENDOLE
>> 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" 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-developers?hl=en
> 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Android Developers" 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-developers?hl=en
> 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Android Developers" 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-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en

Reply via email to