bug: Webview (core 1.18) resizing error

peacemaker

Expert
Licensed User
Longtime User
If to try to change WebView's any Top, Left, Height, Width, even only one of them, or SetLayout - i get the error (Emulator v.2.2):

B4X:
** Activity (browser) Create, isFirst = true **
** Activity (browser) Resume **
browser_activity_resume (java line: 209)

java.lang.NullPointerException
   at anywheresoftware.b4a.objects.ViewWrapper.setTop(ViewWrapper.java:139)
   at peacemaker.onlinewatcherfree.browser._activity_resume(browser.java:209)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:521)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:99)
   at anywheresoftware.b4a.BA.raiseEvent(BA.java:85)
   at peacemaker.onlinewatcherfree.browser.afterFirstLayout(browser.java:89)
   at peacemaker.onlinewatcherfree.browser.access$100(browser.java:15)
   at peacemaker.onlinewatcherfree.browser$WaitForLayout.run(browser.java:71)
   at android.os.Handler.handleCallback(Handler.java:587)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:123)
   at android.app.ActivityThread.main(ActivityThread.java:4627)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:521)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
   at dalvik.system.NativeStart.main(Native Method)
java.lang.NullPointerException

Whole code is simple:

HTML:
'Activity module
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.

End Sub

Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.

   Dim WV As WebView
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("browser")
End Sub

Sub Activity_Resume
wv.Initialize("WV")
wv.Top = 0
wv.Invalidate

WV.LoadUrl(main.URLs.Get(0))
End Sub

Sub Activity_Pause (UserClosed As Boolean)
main.URLS.Set(0,wv.Url)
End Sub


Sub WV_PageFinished (Url As String)
   main.URLS.Set(0,URL)
End Sub

If not to change dimensions - OK, but actually an URL is not shown :(, but it's a second question
 
Last edited:

peacemaker

Expert
Licensed User
Longtime User
Indeed ! Thanks, Agraham.
IMHO better to add this comment shortly near Init metod of (each) manual or XML.
 
Top