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

  • SEARCH
  • Home
  • 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 8712441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:06:39+00:00 2026-06-13T05:06:39+00:00

Every few days I get a crash report for my application with the following

  • 0

Every few days I get a crash report for my application with the following stack trace, or small variants thereof (with different line numbers based on different android versions)

java.lang.NullPointerException at
WebView.java:8241:in `android.webkit.WebView$PrivateHandler.handleMessage'
Handler.java:99:in `android.os.Handler.dispatchMessage'
Looper.java:150:in `android.os.Looper.loop'
ActivityThread.java:4293:in `android.app.ActivityThread.main'
Method.java:-2:in `java.lang.reflect.Method.invokeNative'
Method.java:507:in `java.lang.reflect.Method.invoke'
ZygoteInit.java:849:in `com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run'
ZygoteInit.java:607:in `com.android.internal.os.ZygoteInit.main'
NativeStart.java:-2:in `dalvik.system.NativeStart.main'

This specific stack was on Android 2.3.4 on a HTC EVO 3D PG86100 device.
My app does host several webviews for some oAuth-related login scenarios.

How should I go about trying to figure out how to fix this? I’ve tried looking on grepcode to find the source, but I’m unable to find a matching line number that makes sense. Is my Grepcode-fu weak?

  • 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-13T05:06:39+00:00Added an answer on June 13, 2026 at 5:06 am

    I ran into this issue recently and in my case I managed to figure out that a secondary bug fix was causing this issue.

    So, if you didn’t create a custom class which extends webview, that overrides onCheckIsTextEditor to always return true because of a suggestion in this android bug report… I would stop reading here.

    If you have done that, then it appears that this fix has already been implemented by HTC and for some reason causes it to crash when it receives focus. This issue manifested itself in two places for me, when placing touch events on the view and by setting the views visibility. In my project I set a WebViewClient and waited until the page had finished loading before setting the webview’s visibility to visible. This caused the following stack trace:

    java.lang.NullPointerException at android.webkit.WebView.navHandledKey(WebView.java:9353)
        at android.webkit.WebView.requestFocus(WebView.java:7910)
        at android.view.View.requestFocus(View.java:3718)
        at android.view.View.requestFocus(View.java:3696)
        at android.view.ViewRoot.focusableViewAvailable(ViewRoot.java:1803)
        at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:474)
        at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:474)
        at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:474)
        at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:474)
        at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:474)
        at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:474)
        at android.view.View.setFlags(View.java:4680)
        at android.view.View.setVisibility(View.java:3163)
    

    By wrapping the setVisibility call in a try/catch I was able to determine if I should override the touch events or not. If I caught the event, that would mean I should disable the override. This is an example of what I did:

    try {
        webView.setVisibility(View.VISIBLE);
    } catch (NullPointerException e) {
        Log.i(TAG, "Error setting webview visibility due to overriding focus. It will be disabled.");
        webView.setOverrideOnCheckIsTextEditor(false);
        // Confirm window is visible
        webView.setVisibility(View.VISIBLE);
    }
    

    My custom webview now looks like this, special attention paid to the final two methods:

    /**
     * When using a webview in a dialog, there are issues relating to the keyboard not appearing when focusing on a text box.
     * This overrides a function to ensure the keyboard is shown when focusing on a text box in a webview.
     * See link for bug report and solution.
     *
     * @see http://code.google.com/p/android/issues/detail?id=7189
     * @see http://stackoverflow.com/questions/12325720
     * @author James O'Brien
     * @since 10/16/2012
     */
    public class FocusableWebView extends WebView {
    
        private boolean mOverrideCheckIsTextEditor = true;
    
        /**
         * Default Constructor
         *
         * @param context
         */
        public FocusableWebView(Context context) {
            super(context);
        }
    
        /**
         * Default Constructor
         *
         * @param context
         * @param attrs
         */
        public FocusableWebView(Context context, AttributeSet attrs) {
            super(context, attrs);
        }
    
        /**
         * Default Constructor
         *
         * @param context
         * @param attrs
         * @param defStyle
         */
        public FocusableWebView(Context context, AttributeSet attrs, int defStyle) {
            super(context, attrs, defStyle);
        }
    
        @Override
        public boolean onCheckIsTextEditor() {
            if (mOverrideCheckIsTextEditor) {
                return true;
            } else {
                return super.onCheckIsTextEditor();
            }
        }
    
        /**
         * Enable/Disable overriding of onCheckIsTextEditor to always return true.
         */
        public void setOverrideOnCheckIsTextEditor(boolean foo) {
            mOverrideCheckIsTextEditor = foo;
        }
    }
    

    Sorry I can’t go into more detail about why this fixes the issue. All I can assume is that its related to focus and dynamically disabling it works a treat 🙂

    ** Update (12/11/12) **

    Managed to solve both issues presented above. It seemed to be an issue with the focus of the webview. My code now looks like this

    webView.setVisibility(View.VISIBLE);
    webView.setFocusable(true);
    webView.requestFocus();
    

    I would suggest making sure that you explicitly set the focusable attribute to ‘true’ or calling setFocusable(true).

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

Sidebar

Related Questions

Every few days VS2008 decides to get mad at me and fails to generate
Every few days, google apps starts rejecting my username and password with : SMTPAuthenticationError:
We have a winforms application calling a stored procedure every few seconds. The stored
Possible Duplicate: What are C macros useful for? Every few months I get an
I've got a .net web site which runs on IIS. Once every few days
I've started learning rails3 few days ago, and since today, every time I run
Since few days ago, every time I start Git GUI in a repository, it
I have been trying for a few days to get Sonata Media Bundle working
When I start my application I get the following error: method not found microsoft.visualbasic.msgboxresult
One error I stumble upon every few month is this one: double x =

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.