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 6139373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:58:54+00:00 2026-05-23T17:58:54+00:00

i am using webview in activity and want to use option menu too. but

  • 0

i am using webview in activity and want to use option menu too.
but it does not display option menu on clicking menu button any one guide me what could be the problem?

oncreate
{

 _webView.setWebViewClient(new WebViewClient() {

            @Override
            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                super.onPageStarted(view, url, favicon);
                //if(_dialog != null && !_dialog.isShowing())
                //  _dialog.show();

            }

            @Override
            public void onPageFinished(WebView view, String url) {
                super.onPageFinished(view, url);
                 if (_dialog != null && _dialog.isShowing()) {
                     _dialog.dismiss();
                    }

            }

            @Override
            public void onReceivedError(WebView view, int errorCode,
                    String description, String failingUrl) {
                if (Constants.LOG)
                    Log.d("recieved error", "");
                super.onReceivedError(view, errorCode, description, failingUrl);
                try {
                     if (_dialog != null && _dialog.isShowing())
                    _dialog.dismiss();
                } catch (Exception e) {
                }
            }


        });



        _webView.loadUrl(Constants.URL_VOLUNTEER);

}

menu

 public boolean onCreateOptionsMenu(Menu menu) {

            menu.add(0, 0, 0, Constants.MENU_ITEM_HOME);
            return super.onCreateOptionsMenu(menu);
        }

        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            switch (item.getItemId()) {
            case 0:
                Intent intentHomeScreen= new Intent(this,HomeScreen.class);
                intentHomeScreen.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                startActivity(intentHomeScreen);
                break;
            }
            return super.onOptionsItemSelected(item);
        }


@Override
    public boolean onKeyDown(int keyCode, KeyEvent event) 
    {

        if(keyCode == KeyEvent.KEYCODE_BACK)
        {
            if(_dialog != null)
                _dialog.dismiss();
            if(_webView != null)
            _webView.stopLoading();
            this.finish();

        }

        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-05-23T17:58:54+00:00Added an answer on May 23, 2026 at 5:58 pm

    There is nothing with WebView that interferes with options menus, AFAIK. I have created activities with a WebView and an options menu before, though not in around nine months. Remove the WebView temporarily — if the options menu still misbehaves, then you have some other issue, such as a malformed onKeyDown() implementation.

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

Sidebar

Related Questions

Im using an embedded webview to display a webpage which is made up of
I want to launch an Activity with a webView as its content from current
I have an activity using an xml layout where a WebView is embedded. I
I'm using a webview on my activity. page is loaded from android_asset: webView.loadUrl(file:///android_asset/htm/main.htm); I
I'm creating a sample webpage with button..this webpage am calling in Android using webview.
i am using a webview to load some content in one activity, and then
A button in my WebView is used to go back using the history.back() JavaScript
I encounter a problem of display with a webview i'm using in one of
The following view crashes the iPhone If I comment out the using (webView =
I am using a webview and on that web view i have a image.

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.