Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7750219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:14:04+00:00 2026-06-01T11:14:04+00:00

Im trying to get a custom menu to show when the menu button is

  • 0

Im trying to get a custom menu to show when the menu button is clicked on my phone. Its not showing at all.

I have a register icon caled register.png in this folder /res/drawable.
I have my my_menu.xml in a folder called /res/menu.
Did I lay out my folders wrong or is there something wrong in my code below.

I renamed menu.xml to my_menu.xml
I changed my code and now im getting these errors:

[2012-04-07 07:50:43 – HelloWebView] W/ResourceType( 1560): Bad XML block: no root element node found
[2012-04-07 07:50:43 – HelloWebView] C:\Users\josh\workspace\HelloWebView\res\menu\my_menu.xml:4: error: No resource identifier found for attribute ‘showAsAction’ in package ‘android’

my_menu.xml

<?xml version="1.0" encoding="utf-8"?>

<menu xmlns:android="http://schemas.android.com/apk/res/android">    
    <item android:id="@+id/register"          
        android:icon="@drawable/register"          
        android:title="@string/register"          
        android:showAsAction="ifRoom"/>    

</menu>

Mainapp

public class HelloWebViewActivity extends Activity {
    WebView mWebView;

    /** Called when the activity is first created. */

    public void onCreate(Bundle savedInstanceState) {    
        super.onCreate(savedInstanceState);    
        setContentView(R.layout.main);    
        mWebView = (WebView) findViewById(R.id.webview);    
        mWebView.getSettings().setJavaScriptEnabled(true);    
        mWebView.loadUrl("http://www.Google.com");
        mWebView.setWebViewClient(new HelloWebViewClient());
    }

    private class HelloWebViewClient extends WebViewClient {   
        @Override    
        public boolean shouldOverrideUrlLoading(WebView view, String url) {        
            view.loadUrl(url);        
            return true;    
        }}

    @Override  
    public boolean onKeyDown(int keyCode, KeyEvent event) {    
        if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) {        
            mWebView.goBack();       
            return true;    
        }    
        return super.onKeyDown(keyCode, event);}

    @Override
    public boolean onCreateOptionsMenu(Menu my_menu) {    
    MenuInflater inflater = getMenuInflater();    
    inflater.inflate(R.menu.menu, my_menu);    

    return true;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:14:05+00:00Added an answer on June 1, 2026 at 11:14 am
    inflater.inflate(R.menu.my_menu, my_menu); 
    

    That solved the code alone with removing
    android:showAsAction="ifRoom"

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get the custom dialog to close on button press //set
I'm trying to get a custom ContentProvider to show up under Data & synchronization,
Trying to get custom Done button in Utility Application Create new project in Xcode
I'm trying to get a custom handler to work for a specific URL (or
Ok, so I'm trying to get my custom paging going on the Telerik RadGrid
I am trying to get my Blackberry application to display a custom modal dialog,
I'm making a custom event calendar with PHP. I am trying to get the
i am trying to write a custom event which should get fire when user
I'm trying to implement a custom control in C# and I need to get
I'm trying to build a custom segue, but i can't seem to get the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.