Android Question Upload in webView (WORK)!

Status
Not open for further replies.

RobertoS

Member
Licensed User
Longtime User
Hi all,
I found a way (in a somewhat accidental) to run the file upload in a WebView.
I have used WebViewExtras and WebViewExtras2, but in the .b4a project file I have declared FIRST WebViewExtras2 and THEN WebViewExtras .

When, the code are whis:
B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private WebView1 As WebView
    Private ex As WebViewExtras
    
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Layout1")
    
    WebView1.Top = 0
    WebView1.Left =0
    WebView1.Width = GetDeviceLayoutValues.Width
    WebView1.Height = GetDeviceLayoutValues.Height
    
    ex.addWebChromeClient(WebView1, "ex")
    ex.addJavascriptInterface(WebView1, "ex")
    ex.executeJavascript(WebView1, "ex")
    
    
    WebView1.LoadUrl("https://wetransfer.com/")

End Sub

Strange... but WORK!:eek:

I could not understand the reason, but it works on all the devices (4.4+) on which I tested it. I leave the source code, maybe someone can understand why it works and create a unique wrapper.:)
 

Attachments

  • uploadFile.zip
    3.4 KB · Views: 482
Status
Not open for further replies.
Top