Created
June 29, 2011 20:42
-
-
Save kodeshpa/1054898 to your computer and use it in GitHub Desktop.
Workaround for NPE WebView.onWindowFocusChanged
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Workaround for Null pointer exception in WebView.onWindowFocusChanged | |
*/ | |
public class CustomWebView extends WebView { | |
public CustomWebView(Context context) { | |
super(context); | |
} | |
public CustomWebView(Context context, AttributeSet attrs, int defStyle) { | |
super(context, attrs, defStyle); | |
} | |
public CustomWebView(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
} | |
@Override | |
public void onWindowFocusChanged(boolean hasWindowFocus) { | |
try{ | |
super.onWindowFocusChanged(hasWindowFocus); | |
}catch(NullPointerException e){ | |
// Catch null pointer exception | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment