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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:49:15+00:00 2026-06-12T04:49:15+00:00

My application uses a WebView to display flash video contents. Everything seems to go

  • 0

My application uses a WebView to display flash video contents.
Everything seems to go smoothly
until you try to play full screen on Android ICS devices.
It works fine on devices with lower version.
On ICS devices it throws a NullPointerException.
Here is my code:

    webView.getSettings().setJavaScriptEnabled(true);
            webView.getSettings().setPluginsEnabled(true);
            webView.getSettings().setLoadWithOverviewMode(true);
            webView.getSettings().setUseWideViewPort(true);
            webView.setVerticalScrollbarOverlay(true);
            webView.setWebViewClient(new WebViewClient() {
                private ProgressDialog pd;

                @Override
                public void onPageStarted(WebView view, String url,
                        Bitmap favicon) {
                    pd = new ProgressDialog(TrainingDetailActivity.this);
                    pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
                    pd.setMessage("Loading");
                    pd.show();
                    super.onPageStarted(view, url, favicon);
                }

                @Override
                public void onPageFinished(WebView view, String url) {
                    this.dismissDialog();
                    super.onPageFinished(view, url);
                }

                @Override
                public boolean shouldOverrideUrlLoading(WebView view,
                        String url) {
                    return false;
                }

                private void dismissDialog() {
                    if (pd != null) {
                        pd.dismiss();
                        pd = null;
                    }
                }
            });
            webView.loadDataWithBaseURL(baseUrl, htmlstr, "text/html", "utf-8", null);

After some digging, I found out that in ICS the android.webkit.PluginFullScreenHolder show() method gets called and throws
an NullExceptionPointer. The problem lays there, not on my code.
I tried some work around but none of them works.
– Work around : I added this line:

webView.setWebChromeClient(new WebChromeClient() );

With this work around the NullPointerException does not occur, but the video plays with no sound, and won’t switch to
Full screen mode.
I looked around stackoverflow for solutions, the closest which seems to solve my problem is this answer:
https://stackoverflow.com/a/9921073/1503155
But unfortunately the answerer didn’t explain what is the variable base in his code snippet and I am still stuck.
My question is, is there a way to work around this bug. Is yes, How?
Thanks in advance.
Here is the stacktrace here

  • 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-12T04:49:17+00:00Added an answer on June 12, 2026 at 4:49 am

    My boss gave me permission to share this with you.

    I had the same issue for a long time before cobbling this together.

    Create this as a class, and set the chrome client of your WebView:

    WebView.setWebChromeClient(...);
    

    To this:

    public class FullscreenableChromeClient extends WebChromeClient {
        protected Activity mActivity = null;
    
        private View mCustomView;
        private WebChromeClient.CustomViewCallback mCustomViewCallback;
        private int mOriginalOrientation;
    
        private FrameLayout mContentView;
        private FrameLayout mFullscreenContainer;
    
        private static final FrameLayout.LayoutParams COVER_SCREEN_PARAMS = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    
        public FullscreenableChromeClient(Activity activity) {
            this.mActivity = activity;
        }
    
        @Override
        public void onShowCustomView(View view, int requestedOrientation, WebChromeClient.CustomViewCallback callback) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                if (mCustomView != null) {
                    callback.onCustomViewHidden();
                    return;
                }
    
                mOriginalOrientation = mActivity.getRequestedOrientation();
                FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
                mFullscreenContainer = new FullscreenHolder(mActivity);
                mFullscreenContainer.addView(view, COVER_SCREEN_PARAMS);
                decor.addView(mFullscreenContainer, COVER_SCREEN_PARAMS);
                mCustomView = view;
                setFullscreen(true);
                mCustomViewCallback = callback;
                mActivity.setRequestedOrientation(requestedOrientation);
            }
    
            super.onShowCustomView(view, requestedOrientation, callback);
        }
    
        @Override
        public void onHideCustomView() {
            if (mCustomView == null) {
                return;
            }
    
            setFullscreen(false);
            FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
            decor.removeView(mFullscreenContainer);
            mFullscreenContainer = null;
            mCustomView = null;
            mCustomViewCallback.onCustomViewHidden();
            mActivity.setRequestedOrientation(mOriginalOrientation);
        }
    
        private void setFullscreen(boolean enabled) {
            Window win = mActivity.getWindow();
            WindowManager.LayoutParams winParams = win.getAttributes();
            final int bits = WindowManager.LayoutParams.FLAG_FULLSCREEN;
            if (enabled) {
                winParams.flags |= bits;
            } else {
                winParams.flags &= ~bits;
                if (mCustomView != null) {
                    mCustomView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
                } else {
                    mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
                }
            }
            win.setAttributes(winParams);
        }
    
        private static class FullscreenHolder extends FrameLayout {
            public FullscreenHolder(Context ctx) {
                super(ctx);
                setBackgroundColor(ctx.getResources().getColor(android.R.color.black));
            }
    
            @Override
            public boolean onTouchEvent(MotionEvent evt) {
                return true;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

my application uses a webView to display flash webpage. And there is a inner
I'm developing an Android application that uses a WebView to display the login page
I have a Android Application which is basically uses WebView for all interaction.. How
The ChildBrowser PhoneGap plugin uses a WebView on top of our main application in
My application uses a MapView which will display multiple places. I have the latitude
I'm developing an Android app which uses a webview to display a webpage. Most
I have an iPad application that uses WebViews to display a list of URL's.
I am trying to add a progress/loading bar to my application that uses WebView
I have Webview application that uses progress bar dialog. It works fine but the
I am developing an Android application that uses a WebView pointed at a jQueryMobile-based

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.