- Home /
Question by
VanZeebroeck · Jun 15, 2015 at 11:33 AM ·
androidpluginwebview
Android: NullRefException on creating WebView
I am trying to create a webView to layer over my main view.
Display display = parent.getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
LayoutParams lp = new LinearLayout.LayoutParams((int)(size.x * 0.7f), (int)(size.y * 0.7f), Gravity.CENTER);
WebView webView = new WebView(parent);
webView.setLayoutParams(lp);
But I am getting a NullReferenceException at the line
WebView webView = new WebView(parent);
The parent is my main activity.
Error log:
06-11 10:44:03.110: D/Unity(18449): WeC2jetaiOI
06-11 10:44:03.115: D/Unity(18449): Get size
06-11 10:44:03.115: D/Unity(18449): false
06-11 10:44:03.120: E/Unity(18449): java.lang.NullPointerException
06-11 10:44:03.120: E/Unity(18449):
06-11 10:44:03.120: E/Unity(18449): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebug.gen.cpp Line: 56)
The false is the check if parent is null, right before the line new WebView
.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613201016im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Android webview on Unity 0 Answers
Android Plugin that provides a Webview 2 Answers
Bad performance on quad core Android phones 0 Answers
Regarding Unity's Main Android Activity 1 Answer
android - native twitter connect 0 Answers