开发者

Can't import menuinflator

开发者 https://www.devze.com 2023-03-31 17:09 出处:网络
I am following a beginners guide to android programming and I cannot get menuinflato开发者_开发问答r to import, I keep getting

I am following a beginners guide to android programming and I cannot get menuinflato开发者_开发问答r to import, I keep getting

the import android.view.MenuInflator cannot be resolved

Does this mean I need to add a package to eclipse or is my code wrong in some way? I would really like to continue with the tutorial but I cannot get the example working.

the code is below.

package test.menus;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflator;


public class TestMenusActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

    public boolean onCreateOptionsMenu(Menu menu)
    {
        MenuInflator inflator = getMenuInflator();
        inflator.inflate(R.menu.mainmenu, menu);
        return true;
    }
}


You probably meant MenuInflatEr.

0

精彩评论

暂无评论...
验证码 换一张
取 消