title: How can I change the web view url with Kotlin through a button press?
body: <p>I have a web view in a different activity. I would like to open that activity and change the WebView that is contained within that activity to a specific url when a button is clicked.</p>
  <pre class="lang-kotlin prettyprint-override"><code>val mwebViewArticle = webViewArticle
  mwebViewArticle.loadUrl(&quot;http://www.google.com&quot;)
  val intent = Intent(this, WebView::class.java)
  this.startActivity(intent)
  </code></pre>
  <p>I am getting this error</p>
  <pre><code>2021-07-17 15:20:27.601 404-404/com.example.newsapp E/AndroidRuntime: FATAL EXCEPTION: main
      Process: com.example.newsapp, PID: 404
      java.lang.NullPointerException: Attempt to invoke virtual method 'void android.webkit.WebView.loadUrl(java.lang.String)' on a null object reference
          at com.example.newsapp.MainActivity$onCreate$3.onClick(MainActivity.kt:76)
          at android.view.View.performClick(View.java:6294)
          at android.view.View$PerformClick.run(View.java:24770)
          at android.os.Handler.handleCallback(Handler.java:790)
          at android.os.Handler.dispatchMessage(Handler.java:99)
          at android.os.Looper.loop(Looper.java:164)
          at android.app.ActivityThread.main(ActivityThread.java:6494)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
  </code></pre>