Hi,
I have a layout with an EditText box and a webview on it. It want the textbox to show the URL of the webpage in the webview.
The webview shows fine, but when I do, EditText1.text = webview1.url I get a nullpointerexception error. If I put the URL into a variable, then assign it to the EditText, I get the same error.
This code pukes:
But if I do this:
It works fine.
Here is the error:
EditTextURL.Text = WebViewChoose.url
java.lang.NullPointerException
at anywheresoftware.b4a.objects.TextViewWrapper.setText(TextViewWrapper.java:38)
at b4a.example.activitysettings._activity_create(activitysettings.java:254)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at b4a.example.activitysettings.afterFirstLayout(activitysettings.java:89)
at b4a.example.activitysettings.access$100(activitysettings.java:16)
at b4a.example.activitysettings$WaitForLayout.run(activitysettings.java:74)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Any ideas what I'm doing wrong?
I have a layout with an EditText box and a webview on it. It want the textbox to show the URL of the webpage in the webview.
The webview shows fine, but when I do, EditText1.text = webview1.url I get a nullpointerexception error. If I put the URL into a variable, then assign it to the EditText, I get the same error.
This code pukes:
B4X:
Activity.LoadLayout("Settings")
WebViewChoose.LoadUrl("http://www.google.com/")
EditTextURL.Text = WebViewChoose.url
But if I do this:
B4X:
Activity.LoadLayout("Settings")
WebViewChoose.LoadUrl("http://www.google.com/")
EditTextURL.Text = "http://www.google.com/"
It works fine.
Here is the error:
EditTextURL.Text = WebViewChoose.url
java.lang.NullPointerException
at anywheresoftware.b4a.objects.TextViewWrapper.setText(TextViewWrapper.java:38)
at b4a.example.activitysettings._activity_create(activitysettings.java:254)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at b4a.example.activitysettings.afterFirstLayout(activitysettings.java:89)
at b4a.example.activitysettings.access$100(activitysettings.java:16)
at b4a.example.activitysettings$WaitForLayout.run(activitysettings.java:74)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Any ideas what I'm doing wrong?