Android Question open a url link

kalarius

Active Member
Licensed User
Longtime User
hi,
I want to open my link
h t t p s://youtu.be/6R0r8lC18V8
and I must know the ID of the object to close this link inside of my program

which lib or obj is the better to use?

Kalarakis
Creta
Greece
 

kalarius

Active Member
Licensed User
Longtime User
sir,
I have write this code


WebView1.Initialize("WebView1")
WebView1.LoadUrl( "https ://youtu.be/gIb00j1x2Pk") ' this a youtube video

Activity.LoadLayout("mainV")
and I have add the
android:name="android.permission.INTERNET"
at the manifest editor

but the only thing that I saw at the screen is a white rectangle

please advice
 
Upvote 0

kalarius

Active Member
Licensed User
Longtime User
sir,
no error at the debug console

but

I add the code
WebView1.Initialize(WebView1) ' at this point it show a perple line and remind me that it is string But no error
rem if I write WebView1.Initialize("WebView1") it is the same
Activity.AddView (WebView1,0,0,100%x,50%y)
Url="https://youtu.be/gIb00j1x2Pk"
WebView1.LoadUrl( Url)

Activity.LoadLayout("mainV")

timer1.Initialize("timer1",2000):timer1.Enabled=True


and at the timer_tick
the code
sub timer1_tick()
Dim Url As String
timer1.Enabled=False
Url="https://youtu.be/k5uaVRRMEGI"
WebView1.LoadUrl( Url)
end sub

with the designer I have create an webview1 object at the bottom of the screen


when the activity starts it create the webview1 at the top, load the video and start to play
after it enter at the timer It load the webview1 at the object I have create with the designer
The webview1 form the designer it is at the bottom
So I see the video on the to (with add commad) and the video at the bottom on the webview form the designer

No errors at the debug

my version is 8.5
 
Upvote 0

eps

Expert
Licensed User
Longtime User
I got the same thing as you using your code - might be a slight issue with your code.

I rewrote your code using some I already knew would work - please try this

B4X:
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)

    wv.Initialize("wv")

    Activity.AddView(wv,0,0,100%x,50%y)

    Dim Url="https://youtu.be/gIb00j1x2Pk" As String

    wv.LoadUrl(Url)
End Sub

Not sure you need the LoadLayout part for the main Activity anyway
 
Last edited:
Upvote 0
Top