Menu is missing under Resources - XAMARIN










-2















I am trying to implement a menu on my app bar but why I can't find it under Resource? As you can see, it has color red under it's name. I tried to right click on it but it only says generate menu method. I can't rebuild and deploy it since it gives me that kind of weird error. Also what happen after that is my VS can't read even the Resource itself. I can only solve it if I add another activity or delete it or to restart the VS.



enter image description here



Here is my Menu folder.



enter image description here]2



Here is my full code for activity



using System;
using Android.App;
using Android.OS;
using Android.Views;
using Android.Widget;
using Android.Support.V7.App;
using Android.Support.V7.Widget;
using SupportToolbar = Android.Support.V7.Widget.Toolbar;
using Entities;

namespace RBankCI

[Activity(Label = "PDRN", MainLauncher = true, Theme = "@style/Theme.FullScreenBaseDesign")]
public class Activity_PDRN : AppCompatActivity, IActivityInterface

protected override void OnCreate(Bundle savedInstanceState)

base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.Layout_PDRNForm);
Title = string.Empty;
i1_setupActionBar();


public void i1_setupActionBar()

// Initialize Support ToolBar
SupportToolbar toolBar = FindViewById<SupportToolbar>(Resource.Id.toolBar);
toolBar.SetBackgroundResource(Resource.Drawable.AppBarBackgrounWithTitle);
SetSupportActionBar(toolBar);
SupportActionBar.SetDisplayHomeAsUpEnabled(true);


public void i2_initialization()

throw new NotImplementedException();


public void i3_deserializeIntentExtras()

throw new NotImplementedException();


public void i4_setUpAllClickable()

throw new NotImplementedException();


public void i5_setTextChangeBehaviour()

throw new NotImplementedException();


public void i6_setTextFieldValues()

throw new NotImplementedException();


#region Override OnCreateOptionsMenu()
/// <summary>
/// Create a menu setting
/// </summary>
/// <param name="menu">Menu</param>
/// <returns></returns>
public override bool OnCreateOptionsMenu(IMenu menu)

//Here is the problem. My VS can't read the Menu after Resource

// Create Menu Action
MenuInflater.Inflate(Resource.Menu.menu_form, menu);

return true;

#endregion

#region Override OnOptionsItemSelected()
/// <summary>
/// Event when a user clicks one of the ActionBar Icons
/// </summary>
/// <param name="item">Action Item</param>
/// <returns></returns>
public override bool OnOptionsItemSelected(IMenuItem item)

// Open Navigation Drawer
switch (item.ItemId)

// User click menu icon
case Android.Resource.Id.Home:
OnBackPressed();
return true;
case Android.Resource.Id.menu_clear: //here, I can see and error a constant value is expected. This id is under the menu_form.xml
Toast.MakeText(this, "Clear All Fields", ToastLength.Short).Show();
return true;
case Resource.Id.menu_attach: //here, I can see and error a constant value is expected. This id is under the menu_form.xml
Toast.MakeText(this, "Attach Photo", ToastLength.Short).Show();
return true;
default:
return base.OnOptionsItemSelected(item);


#endregion

#region Override OnBackPressed()
/// <summary>
/// Override OnBackPressed
/// </summary>
public override void OnBackPressed()

try

Finish();

catch (Exception e)

Toast.MakeText(this, ENT_NegativeResponse.somethingWentWrong, 0).Show();


#endregion




Here is my menu_form.xml



<?xml version="1.0" encoding="utf-8" ?>
<!--For all properties see: http://developer.android.com/guide/topics/resources/menu-resource.html-->
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<!-- Declaring Menu Actions -->
<item
android:id="@+id/menu_clear"
android:title="Clear All Fields"
android:icon="@drawable/ic_clear_fields_png_x3"
app:showAsAction="ifRoom"/>

<item
android:id="@+id/menu_attach"
android:title="Attach Photo"
android:icon="@drawable/ic_attach_image_png_x3"
app:showAsAction="ifRoom"/>

</menu>









share|improve this question



















  • 1





    post your menu_form.xml

    – Learning Always
    Jan 8 '18 at 4:40






  • 2





    and What Is Resource.Menu.. Please Don't Copy Screen Shot. Instead Post Your code

    – Learning Always
    Jan 8 '18 at 4:44











  • I take screenshots since we can't see the red line under Menu if I just copy the code .

    – jace
    Jan 8 '18 at 5:14











  • Can someone explain about the downvote?

    – jace
    Jan 8 '18 at 5:53















-2















I am trying to implement a menu on my app bar but why I can't find it under Resource? As you can see, it has color red under it's name. I tried to right click on it but it only says generate menu method. I can't rebuild and deploy it since it gives me that kind of weird error. Also what happen after that is my VS can't read even the Resource itself. I can only solve it if I add another activity or delete it or to restart the VS.



enter image description here



Here is my Menu folder.



enter image description here]2



Here is my full code for activity



using System;
using Android.App;
using Android.OS;
using Android.Views;
using Android.Widget;
using Android.Support.V7.App;
using Android.Support.V7.Widget;
using SupportToolbar = Android.Support.V7.Widget.Toolbar;
using Entities;

namespace RBankCI

[Activity(Label = "PDRN", MainLauncher = true, Theme = "@style/Theme.FullScreenBaseDesign")]
public class Activity_PDRN : AppCompatActivity, IActivityInterface

protected override void OnCreate(Bundle savedInstanceState)

base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.Layout_PDRNForm);
Title = string.Empty;
i1_setupActionBar();


public void i1_setupActionBar()

// Initialize Support ToolBar
SupportToolbar toolBar = FindViewById<SupportToolbar>(Resource.Id.toolBar);
toolBar.SetBackgroundResource(Resource.Drawable.AppBarBackgrounWithTitle);
SetSupportActionBar(toolBar);
SupportActionBar.SetDisplayHomeAsUpEnabled(true);


public void i2_initialization()

throw new NotImplementedException();


public void i3_deserializeIntentExtras()

throw new NotImplementedException();


public void i4_setUpAllClickable()

throw new NotImplementedException();


public void i5_setTextChangeBehaviour()

throw new NotImplementedException();


public void i6_setTextFieldValues()

throw new NotImplementedException();


#region Override OnCreateOptionsMenu()
/// <summary>
/// Create a menu setting
/// </summary>
/// <param name="menu">Menu</param>
/// <returns></returns>
public override bool OnCreateOptionsMenu(IMenu menu)

//Here is the problem. My VS can't read the Menu after Resource

// Create Menu Action
MenuInflater.Inflate(Resource.Menu.menu_form, menu);

return true;

#endregion

#region Override OnOptionsItemSelected()
/// <summary>
/// Event when a user clicks one of the ActionBar Icons
/// </summary>
/// <param name="item">Action Item</param>
/// <returns></returns>
public override bool OnOptionsItemSelected(IMenuItem item)

// Open Navigation Drawer
switch (item.ItemId)

// User click menu icon
case Android.Resource.Id.Home:
OnBackPressed();
return true;
case Android.Resource.Id.menu_clear: //here, I can see and error a constant value is expected. This id is under the menu_form.xml
Toast.MakeText(this, "Clear All Fields", ToastLength.Short).Show();
return true;
case Resource.Id.menu_attach: //here, I can see and error a constant value is expected. This id is under the menu_form.xml
Toast.MakeText(this, "Attach Photo", ToastLength.Short).Show();
return true;
default:
return base.OnOptionsItemSelected(item);


#endregion

#region Override OnBackPressed()
/// <summary>
/// Override OnBackPressed
/// </summary>
public override void OnBackPressed()

try

Finish();

catch (Exception e)

Toast.MakeText(this, ENT_NegativeResponse.somethingWentWrong, 0).Show();


#endregion




Here is my menu_form.xml



<?xml version="1.0" encoding="utf-8" ?>
<!--For all properties see: http://developer.android.com/guide/topics/resources/menu-resource.html-->
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<!-- Declaring Menu Actions -->
<item
android:id="@+id/menu_clear"
android:title="Clear All Fields"
android:icon="@drawable/ic_clear_fields_png_x3"
app:showAsAction="ifRoom"/>

<item
android:id="@+id/menu_attach"
android:title="Attach Photo"
android:icon="@drawable/ic_attach_image_png_x3"
app:showAsAction="ifRoom"/>

</menu>









share|improve this question



















  • 1





    post your menu_form.xml

    – Learning Always
    Jan 8 '18 at 4:40






  • 2





    and What Is Resource.Menu.. Please Don't Copy Screen Shot. Instead Post Your code

    – Learning Always
    Jan 8 '18 at 4:44











  • I take screenshots since we can't see the red line under Menu if I just copy the code .

    – jace
    Jan 8 '18 at 5:14











  • Can someone explain about the downvote?

    – jace
    Jan 8 '18 at 5:53













-2












-2








-2








I am trying to implement a menu on my app bar but why I can't find it under Resource? As you can see, it has color red under it's name. I tried to right click on it but it only says generate menu method. I can't rebuild and deploy it since it gives me that kind of weird error. Also what happen after that is my VS can't read even the Resource itself. I can only solve it if I add another activity or delete it or to restart the VS.



enter image description here



Here is my Menu folder.



enter image description here]2



Here is my full code for activity



using System;
using Android.App;
using Android.OS;
using Android.Views;
using Android.Widget;
using Android.Support.V7.App;
using Android.Support.V7.Widget;
using SupportToolbar = Android.Support.V7.Widget.Toolbar;
using Entities;

namespace RBankCI

[Activity(Label = "PDRN", MainLauncher = true, Theme = "@style/Theme.FullScreenBaseDesign")]
public class Activity_PDRN : AppCompatActivity, IActivityInterface

protected override void OnCreate(Bundle savedInstanceState)

base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.Layout_PDRNForm);
Title = string.Empty;
i1_setupActionBar();


public void i1_setupActionBar()

// Initialize Support ToolBar
SupportToolbar toolBar = FindViewById<SupportToolbar>(Resource.Id.toolBar);
toolBar.SetBackgroundResource(Resource.Drawable.AppBarBackgrounWithTitle);
SetSupportActionBar(toolBar);
SupportActionBar.SetDisplayHomeAsUpEnabled(true);


public void i2_initialization()

throw new NotImplementedException();


public void i3_deserializeIntentExtras()

throw new NotImplementedException();


public void i4_setUpAllClickable()

throw new NotImplementedException();


public void i5_setTextChangeBehaviour()

throw new NotImplementedException();


public void i6_setTextFieldValues()

throw new NotImplementedException();


#region Override OnCreateOptionsMenu()
/// <summary>
/// Create a menu setting
/// </summary>
/// <param name="menu">Menu</param>
/// <returns></returns>
public override bool OnCreateOptionsMenu(IMenu menu)

//Here is the problem. My VS can't read the Menu after Resource

// Create Menu Action
MenuInflater.Inflate(Resource.Menu.menu_form, menu);

return true;

#endregion

#region Override OnOptionsItemSelected()
/// <summary>
/// Event when a user clicks one of the ActionBar Icons
/// </summary>
/// <param name="item">Action Item</param>
/// <returns></returns>
public override bool OnOptionsItemSelected(IMenuItem item)

// Open Navigation Drawer
switch (item.ItemId)

// User click menu icon
case Android.Resource.Id.Home:
OnBackPressed();
return true;
case Android.Resource.Id.menu_clear: //here, I can see and error a constant value is expected. This id is under the menu_form.xml
Toast.MakeText(this, "Clear All Fields", ToastLength.Short).Show();
return true;
case Resource.Id.menu_attach: //here, I can see and error a constant value is expected. This id is under the menu_form.xml
Toast.MakeText(this, "Attach Photo", ToastLength.Short).Show();
return true;
default:
return base.OnOptionsItemSelected(item);


#endregion

#region Override OnBackPressed()
/// <summary>
/// Override OnBackPressed
/// </summary>
public override void OnBackPressed()

try

Finish();

catch (Exception e)

Toast.MakeText(this, ENT_NegativeResponse.somethingWentWrong, 0).Show();


#endregion




Here is my menu_form.xml



<?xml version="1.0" encoding="utf-8" ?>
<!--For all properties see: http://developer.android.com/guide/topics/resources/menu-resource.html-->
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<!-- Declaring Menu Actions -->
<item
android:id="@+id/menu_clear"
android:title="Clear All Fields"
android:icon="@drawable/ic_clear_fields_png_x3"
app:showAsAction="ifRoom"/>

<item
android:id="@+id/menu_attach"
android:title="Attach Photo"
android:icon="@drawable/ic_attach_image_png_x3"
app:showAsAction="ifRoom"/>

</menu>









share|improve this question
















I am trying to implement a menu on my app bar but why I can't find it under Resource? As you can see, it has color red under it's name. I tried to right click on it but it only says generate menu method. I can't rebuild and deploy it since it gives me that kind of weird error. Also what happen after that is my VS can't read even the Resource itself. I can only solve it if I add another activity or delete it or to restart the VS.



enter image description here



Here is my Menu folder.



enter image description here]2



Here is my full code for activity



using System;
using Android.App;
using Android.OS;
using Android.Views;
using Android.Widget;
using Android.Support.V7.App;
using Android.Support.V7.Widget;
using SupportToolbar = Android.Support.V7.Widget.Toolbar;
using Entities;

namespace RBankCI

[Activity(Label = "PDRN", MainLauncher = true, Theme = "@style/Theme.FullScreenBaseDesign")]
public class Activity_PDRN : AppCompatActivity, IActivityInterface

protected override void OnCreate(Bundle savedInstanceState)

base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.Layout_PDRNForm);
Title = string.Empty;
i1_setupActionBar();


public void i1_setupActionBar()

// Initialize Support ToolBar
SupportToolbar toolBar = FindViewById<SupportToolbar>(Resource.Id.toolBar);
toolBar.SetBackgroundResource(Resource.Drawable.AppBarBackgrounWithTitle);
SetSupportActionBar(toolBar);
SupportActionBar.SetDisplayHomeAsUpEnabled(true);


public void i2_initialization()

throw new NotImplementedException();


public void i3_deserializeIntentExtras()

throw new NotImplementedException();


public void i4_setUpAllClickable()

throw new NotImplementedException();


public void i5_setTextChangeBehaviour()

throw new NotImplementedException();


public void i6_setTextFieldValues()

throw new NotImplementedException();


#region Override OnCreateOptionsMenu()
/// <summary>
/// Create a menu setting
/// </summary>
/// <param name="menu">Menu</param>
/// <returns></returns>
public override bool OnCreateOptionsMenu(IMenu menu)

//Here is the problem. My VS can't read the Menu after Resource

// Create Menu Action
MenuInflater.Inflate(Resource.Menu.menu_form, menu);

return true;

#endregion

#region Override OnOptionsItemSelected()
/// <summary>
/// Event when a user clicks one of the ActionBar Icons
/// </summary>
/// <param name="item">Action Item</param>
/// <returns></returns>
public override bool OnOptionsItemSelected(IMenuItem item)

// Open Navigation Drawer
switch (item.ItemId)

// User click menu icon
case Android.Resource.Id.Home:
OnBackPressed();
return true;
case Android.Resource.Id.menu_clear: //here, I can see and error a constant value is expected. This id is under the menu_form.xml
Toast.MakeText(this, "Clear All Fields", ToastLength.Short).Show();
return true;
case Resource.Id.menu_attach: //here, I can see and error a constant value is expected. This id is under the menu_form.xml
Toast.MakeText(this, "Attach Photo", ToastLength.Short).Show();
return true;
default:
return base.OnOptionsItemSelected(item);


#endregion

#region Override OnBackPressed()
/// <summary>
/// Override OnBackPressed
/// </summary>
public override void OnBackPressed()

try

Finish();

catch (Exception e)

Toast.MakeText(this, ENT_NegativeResponse.somethingWentWrong, 0).Show();


#endregion




Here is my menu_form.xml



<?xml version="1.0" encoding="utf-8" ?>
<!--For all properties see: http://developer.android.com/guide/topics/resources/menu-resource.html-->
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<!-- Declaring Menu Actions -->
<item
android:id="@+id/menu_clear"
android:title="Clear All Fields"
android:icon="@drawable/ic_clear_fields_png_x3"
app:showAsAction="ifRoom"/>

<item
android:id="@+id/menu_attach"
android:title="Attach Photo"
android:icon="@drawable/ic_attach_image_png_x3"
app:showAsAction="ifRoom"/>

</menu>






android xamarin xamarin.android






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 8 '18 at 5:59







jace

















asked Jan 8 '18 at 4:37









jacejace

705524




705524







  • 1





    post your menu_form.xml

    – Learning Always
    Jan 8 '18 at 4:40






  • 2





    and What Is Resource.Menu.. Please Don't Copy Screen Shot. Instead Post Your code

    – Learning Always
    Jan 8 '18 at 4:44











  • I take screenshots since we can't see the red line under Menu if I just copy the code .

    – jace
    Jan 8 '18 at 5:14











  • Can someone explain about the downvote?

    – jace
    Jan 8 '18 at 5:53












  • 1





    post your menu_form.xml

    – Learning Always
    Jan 8 '18 at 4:40






  • 2





    and What Is Resource.Menu.. Please Don't Copy Screen Shot. Instead Post Your code

    – Learning Always
    Jan 8 '18 at 4:44











  • I take screenshots since we can't see the red line under Menu if I just copy the code .

    – jace
    Jan 8 '18 at 5:14











  • Can someone explain about the downvote?

    – jace
    Jan 8 '18 at 5:53







1




1





post your menu_form.xml

– Learning Always
Jan 8 '18 at 4:40





post your menu_form.xml

– Learning Always
Jan 8 '18 at 4:40




2




2





and What Is Resource.Menu.. Please Don't Copy Screen Shot. Instead Post Your code

– Learning Always
Jan 8 '18 at 4:44





and What Is Resource.Menu.. Please Don't Copy Screen Shot. Instead Post Your code

– Learning Always
Jan 8 '18 at 4:44













I take screenshots since we can't see the red line under Menu if I just copy the code .

– jace
Jan 8 '18 at 5:14





I take screenshots since we can't see the red line under Menu if I just copy the code .

– jace
Jan 8 '18 at 5:14













Can someone explain about the downvote?

– jace
Jan 8 '18 at 5:53





Can someone explain about the downvote?

– jace
Jan 8 '18 at 5:53












4 Answers
4






active

oldest

votes


















1














Use this-:



MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_form, menu);


In this case Import R file that is of your current package






share|improve this answer























  • still nothing. I think it just instantiate the MenuInflater to variable inflater .

    – jace
    Jan 8 '18 at 5:38











  • Try changing Resource to R file and try importing that as popupMenu.inflate(R.menu.medication_list_more_option);

    – Shivam Oberoi
    Jan 8 '18 at 5:41











  • No I can't. R is for android and Resource is for xamarin . Camel Casing and Some codes are slightly different like what you mentioned getMenuInflater is MenuInflater in xamarin.

    – jace
    Jan 8 '18 at 5:51


















0















Menu is missing under Resources - XAMARIN




Check if the resource id has been generated in Resource.designer.cs.



enter image description here



In my project, the resource id is :



public partial class Id

...
// aapt resource value: 0x7f0b007b
public const int menu_attach = 2131427451;

// aapt resource value: 0x7f0b007a
public const int menu_clear = 2131427450;
...


...

public partial class Menu


// aapt resource value: 0x7f0d0000
public const int menu_form = 2131558400;

static Menu()

global::Android.Runtime.ResourceIdManager.UpdateIdValues();


private Menu()





Solution :



If it has not been generated, usually clean and rebuilding the project will generate it again, unless there is a syntax error somewhere.






share|improve this answer























  • Nah it's not generating Menu, menu_form or even the menu_clear and menu_attach. If I comment the MenuInflater, my program works. But not if I try to initialize it.

    – jace
    Jan 9 '18 at 7:23











  • @jace, delete your project bin and obj files and rebuild again, then you should Menu resource in your project.

    – York Shen
    Jan 9 '18 at 7:29











  • I did that once, even the file under xamarin folder on appdata. restarted and done anything I could but I don't know why.

    – jace
    Jan 9 '18 at 7:30











  • I already found the solution. Thanks to your comment. I'll just post is as an answer if ever others will have same situation as mine

    – jace
    Jan 9 '18 at 7:31


















0














UPDATE



Updating Xamarin for Visual Studio solved the issue for missing Menu under Resource . Got the blue-green color after




I found it back from my Resource.Designer.cs although it still have a message under it: 'Resource' does not contain a definition for 'Menu' and for the buttons they have "A constant value is required". But still it is working with redlines.



For reference of others, this is what I did.



My VS.Xamarin is good with my menu before until it prompts me with message that it is not recognizable. Here are my steps that I tried:

1. Restarted the VS

2. Removed bin and obj under project

3. Removed xamarin folder content under user/appdata/local/xamarin

4. Clean and Rebuild as many as I can

5. Create new menu folder under resource

6. Create menu file from add button but I think this is also a problem



Part of Soution

menu under add button generates menu_form.xml file while xamarin read an .axml format. So my solution is to create a layout, copy what my menu_form.xml have and clean then rebuild. Menu, menu_form and it's elements showed up to Resource.Designer.cs after that.



It's actually a problem for me since it is working before but suddenly stopped and gave me an error.

Still I have an error regarding Resource.Menu the same from the beginning with a red line yet it's working well. I don't know why my VS gives me that error.






share|improve this answer
































    0














    Make sure you've edit it:



    enter image description here



    (Change BuildAction to AndroidResource)






    share|improve this answer
























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f48144291%2fmenu-is-missing-under-resources-xamarin%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      Use this-:



      MenuInflater inflater = getMenuInflater();
      inflater.inflate(R.menu.menu_form, menu);


      In this case Import R file that is of your current package






      share|improve this answer























      • still nothing. I think it just instantiate the MenuInflater to variable inflater .

        – jace
        Jan 8 '18 at 5:38











      • Try changing Resource to R file and try importing that as popupMenu.inflate(R.menu.medication_list_more_option);

        – Shivam Oberoi
        Jan 8 '18 at 5:41











      • No I can't. R is for android and Resource is for xamarin . Camel Casing and Some codes are slightly different like what you mentioned getMenuInflater is MenuInflater in xamarin.

        – jace
        Jan 8 '18 at 5:51















      1














      Use this-:



      MenuInflater inflater = getMenuInflater();
      inflater.inflate(R.menu.menu_form, menu);


      In this case Import R file that is of your current package






      share|improve this answer























      • still nothing. I think it just instantiate the MenuInflater to variable inflater .

        – jace
        Jan 8 '18 at 5:38











      • Try changing Resource to R file and try importing that as popupMenu.inflate(R.menu.medication_list_more_option);

        – Shivam Oberoi
        Jan 8 '18 at 5:41











      • No I can't. R is for android and Resource is for xamarin . Camel Casing and Some codes are slightly different like what you mentioned getMenuInflater is MenuInflater in xamarin.

        – jace
        Jan 8 '18 at 5:51













      1












      1








      1







      Use this-:



      MenuInflater inflater = getMenuInflater();
      inflater.inflate(R.menu.menu_form, menu);


      In this case Import R file that is of your current package






      share|improve this answer













      Use this-:



      MenuInflater inflater = getMenuInflater();
      inflater.inflate(R.menu.menu_form, menu);


      In this case Import R file that is of your current package







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Jan 8 '18 at 5:01









      Shivam OberoiShivam Oberoi

      80029




      80029












      • still nothing. I think it just instantiate the MenuInflater to variable inflater .

        – jace
        Jan 8 '18 at 5:38











      • Try changing Resource to R file and try importing that as popupMenu.inflate(R.menu.medication_list_more_option);

        – Shivam Oberoi
        Jan 8 '18 at 5:41











      • No I can't. R is for android and Resource is for xamarin . Camel Casing and Some codes are slightly different like what you mentioned getMenuInflater is MenuInflater in xamarin.

        – jace
        Jan 8 '18 at 5:51

















      • still nothing. I think it just instantiate the MenuInflater to variable inflater .

        – jace
        Jan 8 '18 at 5:38











      • Try changing Resource to R file and try importing that as popupMenu.inflate(R.menu.medication_list_more_option);

        – Shivam Oberoi
        Jan 8 '18 at 5:41











      • No I can't. R is for android and Resource is for xamarin . Camel Casing and Some codes are slightly different like what you mentioned getMenuInflater is MenuInflater in xamarin.

        – jace
        Jan 8 '18 at 5:51
















      still nothing. I think it just instantiate the MenuInflater to variable inflater .

      – jace
      Jan 8 '18 at 5:38





      still nothing. I think it just instantiate the MenuInflater to variable inflater .

      – jace
      Jan 8 '18 at 5:38













      Try changing Resource to R file and try importing that as popupMenu.inflate(R.menu.medication_list_more_option);

      – Shivam Oberoi
      Jan 8 '18 at 5:41





      Try changing Resource to R file and try importing that as popupMenu.inflate(R.menu.medication_list_more_option);

      – Shivam Oberoi
      Jan 8 '18 at 5:41













      No I can't. R is for android and Resource is for xamarin . Camel Casing and Some codes are slightly different like what you mentioned getMenuInflater is MenuInflater in xamarin.

      – jace
      Jan 8 '18 at 5:51





      No I can't. R is for android and Resource is for xamarin . Camel Casing and Some codes are slightly different like what you mentioned getMenuInflater is MenuInflater in xamarin.

      – jace
      Jan 8 '18 at 5:51













      0















      Menu is missing under Resources - XAMARIN




      Check if the resource id has been generated in Resource.designer.cs.



      enter image description here



      In my project, the resource id is :



      public partial class Id

      ...
      // aapt resource value: 0x7f0b007b
      public const int menu_attach = 2131427451;

      // aapt resource value: 0x7f0b007a
      public const int menu_clear = 2131427450;
      ...


      ...

      public partial class Menu


      // aapt resource value: 0x7f0d0000
      public const int menu_form = 2131558400;

      static Menu()

      global::Android.Runtime.ResourceIdManager.UpdateIdValues();


      private Menu()





      Solution :



      If it has not been generated, usually clean and rebuilding the project will generate it again, unless there is a syntax error somewhere.






      share|improve this answer























      • Nah it's not generating Menu, menu_form or even the menu_clear and menu_attach. If I comment the MenuInflater, my program works. But not if I try to initialize it.

        – jace
        Jan 9 '18 at 7:23











      • @jace, delete your project bin and obj files and rebuild again, then you should Menu resource in your project.

        – York Shen
        Jan 9 '18 at 7:29











      • I did that once, even the file under xamarin folder on appdata. restarted and done anything I could but I don't know why.

        – jace
        Jan 9 '18 at 7:30











      • I already found the solution. Thanks to your comment. I'll just post is as an answer if ever others will have same situation as mine

        – jace
        Jan 9 '18 at 7:31















      0















      Menu is missing under Resources - XAMARIN




      Check if the resource id has been generated in Resource.designer.cs.



      enter image description here



      In my project, the resource id is :



      public partial class Id

      ...
      // aapt resource value: 0x7f0b007b
      public const int menu_attach = 2131427451;

      // aapt resource value: 0x7f0b007a
      public const int menu_clear = 2131427450;
      ...


      ...

      public partial class Menu


      // aapt resource value: 0x7f0d0000
      public const int menu_form = 2131558400;

      static Menu()

      global::Android.Runtime.ResourceIdManager.UpdateIdValues();


      private Menu()





      Solution :



      If it has not been generated, usually clean and rebuilding the project will generate it again, unless there is a syntax error somewhere.






      share|improve this answer























      • Nah it's not generating Menu, menu_form or even the menu_clear and menu_attach. If I comment the MenuInflater, my program works. But not if I try to initialize it.

        – jace
        Jan 9 '18 at 7:23











      • @jace, delete your project bin and obj files and rebuild again, then you should Menu resource in your project.

        – York Shen
        Jan 9 '18 at 7:29











      • I did that once, even the file under xamarin folder on appdata. restarted and done anything I could but I don't know why.

        – jace
        Jan 9 '18 at 7:30











      • I already found the solution. Thanks to your comment. I'll just post is as an answer if ever others will have same situation as mine

        – jace
        Jan 9 '18 at 7:31













      0












      0








      0








      Menu is missing under Resources - XAMARIN




      Check if the resource id has been generated in Resource.designer.cs.



      enter image description here



      In my project, the resource id is :



      public partial class Id

      ...
      // aapt resource value: 0x7f0b007b
      public const int menu_attach = 2131427451;

      // aapt resource value: 0x7f0b007a
      public const int menu_clear = 2131427450;
      ...


      ...

      public partial class Menu


      // aapt resource value: 0x7f0d0000
      public const int menu_form = 2131558400;

      static Menu()

      global::Android.Runtime.ResourceIdManager.UpdateIdValues();


      private Menu()





      Solution :



      If it has not been generated, usually clean and rebuilding the project will generate it again, unless there is a syntax error somewhere.






      share|improve this answer














      Menu is missing under Resources - XAMARIN




      Check if the resource id has been generated in Resource.designer.cs.



      enter image description here



      In my project, the resource id is :



      public partial class Id

      ...
      // aapt resource value: 0x7f0b007b
      public const int menu_attach = 2131427451;

      // aapt resource value: 0x7f0b007a
      public const int menu_clear = 2131427450;
      ...


      ...

      public partial class Menu


      // aapt resource value: 0x7f0d0000
      public const int menu_form = 2131558400;

      static Menu()

      global::Android.Runtime.ResourceIdManager.UpdateIdValues();


      private Menu()





      Solution :



      If it has not been generated, usually clean and rebuilding the project will generate it again, unless there is a syntax error somewhere.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Jan 9 '18 at 2:04









      York ShenYork Shen

      6,9211325




      6,9211325












      • Nah it's not generating Menu, menu_form or even the menu_clear and menu_attach. If I comment the MenuInflater, my program works. But not if I try to initialize it.

        – jace
        Jan 9 '18 at 7:23











      • @jace, delete your project bin and obj files and rebuild again, then you should Menu resource in your project.

        – York Shen
        Jan 9 '18 at 7:29











      • I did that once, even the file under xamarin folder on appdata. restarted and done anything I could but I don't know why.

        – jace
        Jan 9 '18 at 7:30











      • I already found the solution. Thanks to your comment. I'll just post is as an answer if ever others will have same situation as mine

        – jace
        Jan 9 '18 at 7:31

















      • Nah it's not generating Menu, menu_form or even the menu_clear and menu_attach. If I comment the MenuInflater, my program works. But not if I try to initialize it.

        – jace
        Jan 9 '18 at 7:23











      • @jace, delete your project bin and obj files and rebuild again, then you should Menu resource in your project.

        – York Shen
        Jan 9 '18 at 7:29











      • I did that once, even the file under xamarin folder on appdata. restarted and done anything I could but I don't know why.

        – jace
        Jan 9 '18 at 7:30











      • I already found the solution. Thanks to your comment. I'll just post is as an answer if ever others will have same situation as mine

        – jace
        Jan 9 '18 at 7:31
















      Nah it's not generating Menu, menu_form or even the menu_clear and menu_attach. If I comment the MenuInflater, my program works. But not if I try to initialize it.

      – jace
      Jan 9 '18 at 7:23





      Nah it's not generating Menu, menu_form or even the menu_clear and menu_attach. If I comment the MenuInflater, my program works. But not if I try to initialize it.

      – jace
      Jan 9 '18 at 7:23













      @jace, delete your project bin and obj files and rebuild again, then you should Menu resource in your project.

      – York Shen
      Jan 9 '18 at 7:29





      @jace, delete your project bin and obj files and rebuild again, then you should Menu resource in your project.

      – York Shen
      Jan 9 '18 at 7:29













      I did that once, even the file under xamarin folder on appdata. restarted and done anything I could but I don't know why.

      – jace
      Jan 9 '18 at 7:30





      I did that once, even the file under xamarin folder on appdata. restarted and done anything I could but I don't know why.

      – jace
      Jan 9 '18 at 7:30













      I already found the solution. Thanks to your comment. I'll just post is as an answer if ever others will have same situation as mine

      – jace
      Jan 9 '18 at 7:31





      I already found the solution. Thanks to your comment. I'll just post is as an answer if ever others will have same situation as mine

      – jace
      Jan 9 '18 at 7:31











      0














      UPDATE



      Updating Xamarin for Visual Studio solved the issue for missing Menu under Resource . Got the blue-green color after




      I found it back from my Resource.Designer.cs although it still have a message under it: 'Resource' does not contain a definition for 'Menu' and for the buttons they have "A constant value is required". But still it is working with redlines.



      For reference of others, this is what I did.



      My VS.Xamarin is good with my menu before until it prompts me with message that it is not recognizable. Here are my steps that I tried:

      1. Restarted the VS

      2. Removed bin and obj under project

      3. Removed xamarin folder content under user/appdata/local/xamarin

      4. Clean and Rebuild as many as I can

      5. Create new menu folder under resource

      6. Create menu file from add button but I think this is also a problem



      Part of Soution

      menu under add button generates menu_form.xml file while xamarin read an .axml format. So my solution is to create a layout, copy what my menu_form.xml have and clean then rebuild. Menu, menu_form and it's elements showed up to Resource.Designer.cs after that.



      It's actually a problem for me since it is working before but suddenly stopped and gave me an error.

      Still I have an error regarding Resource.Menu the same from the beginning with a red line yet it's working well. I don't know why my VS gives me that error.






      share|improve this answer





























        0














        UPDATE



        Updating Xamarin for Visual Studio solved the issue for missing Menu under Resource . Got the blue-green color after




        I found it back from my Resource.Designer.cs although it still have a message under it: 'Resource' does not contain a definition for 'Menu' and for the buttons they have "A constant value is required". But still it is working with redlines.



        For reference of others, this is what I did.



        My VS.Xamarin is good with my menu before until it prompts me with message that it is not recognizable. Here are my steps that I tried:

        1. Restarted the VS

        2. Removed bin and obj under project

        3. Removed xamarin folder content under user/appdata/local/xamarin

        4. Clean and Rebuild as many as I can

        5. Create new menu folder under resource

        6. Create menu file from add button but I think this is also a problem



        Part of Soution

        menu under add button generates menu_form.xml file while xamarin read an .axml format. So my solution is to create a layout, copy what my menu_form.xml have and clean then rebuild. Menu, menu_form and it's elements showed up to Resource.Designer.cs after that.



        It's actually a problem for me since it is working before but suddenly stopped and gave me an error.

        Still I have an error regarding Resource.Menu the same from the beginning with a red line yet it's working well. I don't know why my VS gives me that error.






        share|improve this answer



























          0












          0








          0







          UPDATE



          Updating Xamarin for Visual Studio solved the issue for missing Menu under Resource . Got the blue-green color after




          I found it back from my Resource.Designer.cs although it still have a message under it: 'Resource' does not contain a definition for 'Menu' and for the buttons they have "A constant value is required". But still it is working with redlines.



          For reference of others, this is what I did.



          My VS.Xamarin is good with my menu before until it prompts me with message that it is not recognizable. Here are my steps that I tried:

          1. Restarted the VS

          2. Removed bin and obj under project

          3. Removed xamarin folder content under user/appdata/local/xamarin

          4. Clean and Rebuild as many as I can

          5. Create new menu folder under resource

          6. Create menu file from add button but I think this is also a problem



          Part of Soution

          menu under add button generates menu_form.xml file while xamarin read an .axml format. So my solution is to create a layout, copy what my menu_form.xml have and clean then rebuild. Menu, menu_form and it's elements showed up to Resource.Designer.cs after that.



          It's actually a problem for me since it is working before but suddenly stopped and gave me an error.

          Still I have an error regarding Resource.Menu the same from the beginning with a red line yet it's working well. I don't know why my VS gives me that error.






          share|improve this answer















          UPDATE



          Updating Xamarin for Visual Studio solved the issue for missing Menu under Resource . Got the blue-green color after




          I found it back from my Resource.Designer.cs although it still have a message under it: 'Resource' does not contain a definition for 'Menu' and for the buttons they have "A constant value is required". But still it is working with redlines.



          For reference of others, this is what I did.



          My VS.Xamarin is good with my menu before until it prompts me with message that it is not recognizable. Here are my steps that I tried:

          1. Restarted the VS

          2. Removed bin and obj under project

          3. Removed xamarin folder content under user/appdata/local/xamarin

          4. Clean and Rebuild as many as I can

          5. Create new menu folder under resource

          6. Create menu file from add button but I think this is also a problem



          Part of Soution

          menu under add button generates menu_form.xml file while xamarin read an .axml format. So my solution is to create a layout, copy what my menu_form.xml have and clean then rebuild. Menu, menu_form and it's elements showed up to Resource.Designer.cs after that.



          It's actually a problem for me since it is working before but suddenly stopped and gave me an error.

          Still I have an error regarding Resource.Menu the same from the beginning with a red line yet it's working well. I don't know why my VS gives me that error.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 10 '18 at 2:37

























          answered Jan 9 '18 at 7:44









          jacejace

          705524




          705524





















              0














              Make sure you've edit it:



              enter image description here



              (Change BuildAction to AndroidResource)






              share|improve this answer





























                0














                Make sure you've edit it:



                enter image description here



                (Change BuildAction to AndroidResource)






                share|improve this answer



























                  0












                  0








                  0







                  Make sure you've edit it:



                  enter image description here



                  (Change BuildAction to AndroidResource)






                  share|improve this answer















                  Make sure you've edit it:



                  enter image description here



                  (Change BuildAction to AndroidResource)







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 15 '18 at 8:26

























                  answered Nov 15 '18 at 8:19









                  Huu Bao NguyenHuu Bao Nguyen

                  21112




                  21112



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f48144291%2fmenu-is-missing-under-resources-xamarin%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Top Tejano songwriter Luis Silva dead of heart attack at 64

                      ReactJS Fetched API data displays live - need Data displayed static

                      Evgeni Malkin