Android Question Cannot scroll web page with Gesture library

Jocelin

Member
Licensed User
Hello

I have a problem with Gesture library. When I add a Gesture on my web page like Sub Gesture_onDrag()
I cannot scroll my page. Do you know why?

Thank you

Here the code:

B4X:
Sub Process_Globals
End Sub

Sub Globals
    Dim WebViewExtras1 As WebViewExtras
    Dim WebView1 As WebView
    Dim GD As GestureDetector
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("layoutMain")
  
    '   add the B4A javascript interface to the WebView
    WebViewExtras1.addJavascriptInterface(WebView1, "B4A")
  
    '   adding a WebChromeClient will log all browser console message to the android log
    '   so any webpage or javascript errors will be logged
    WebViewExtras1.addWebChromeClient(WebView1, "")
  
    '   now load a web page
    WebView1.LoadUrl("http://www.b4x.com/android/forum/threads/getting-the-source-code-of-a-webpage-with-webview-and-webviewextras.34418/#post-202076")

    GD.SetOnGestureListener(WebView1, "GD")

End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub

Sub WebView1_PageFinished (Url As String)
    '   Now that the web page has loaded we can get the page content as a String
  
    '   see the documentation http://www.b4x.com/forum/additional-libraries-classes-official-updates/12453-webviewextras.html#post70053 for details of the second parameter callUIThread
  
    Dim Javascript As String
    Javascript="B4A.CallSub('Process_HTML', false, document.documentElement.outerHTML)"
  

    Log("PageFinished: "&Javascript)
    WebViewExtras1.executeJavascript(WebView1, Javascript)
End Sub

Sub Process_HTML(Html As String)
    '   This is the Sub that we'll get the web page to send it's HTML content to
  
    '   Log may truncate a large page so you'll not see all of the HTML in the log but the 'html' String should still contain all of the web page HTML
  
    Log("Process_HTML: "&Html)
End Sub


Sub GD_onDrag(deltaX As Float, deltaY As Float, MotionEvent As Object)
    Log("   onDrag deltaX = " & deltaX & ", deltaY = " & deltaY & ", ev = " & MotionEvent)
   
End Sub
 
Top