How to Reference a Resource File?

73 views Asked by At

I am making an app, and I need to reference a resource file while in the main activity. The path is res/menu/main.xml, how do I do this? Here is the source code.

package com.example.bradenmyers.quikiflipi;

    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.support.v7.widget.PopupMenu;
    import android.view.Menu;
    import android.view.MenuInflater;

    public class MainActivity extends AppCompatActivity {

        private PopupMenu menuInflator;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R(This R is Red).layout.activity_main);
        }

        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            getMenuInflator().inflate(R(This R is also Red).menu.main, menu);
            return super.onCreateOptionsMenu(menu);
        }

        private MenuInflater getMenuInflator() {
            return null;
        }
    }
0

There are 0 answers