Android Question Load URL list txt file Webview

pemulanih

Member
im newbie using b4a and planning make #1 app and got stuck.?

i have code:
B4X:
Sub Process_Globals
    Dim urllist As List
    Dim geturl As String
    urllist = File.ReadList(File.DirAssets,"url.txt")
    geturl = (urllist.Get(0))
End Sub

Sub Globals
    Private webview1 As WebView
    Private BtnStart As Button  
End Sub

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

Sub BtnStart_Click
    webview1.LoadUrl(geturl)
    ??????????????????????????// 'if website load succes, then i want load automaticly
    ??????????????????????????// '2 line then 3 then 4..etc..till end line
    ??????????????????????????
End Sub

how can i do that, teach me master ?
 
Last edited:

kisoft

Well-Known Member
Licensed User
Longtime User
Hello, this is for starters.
B4X:
Sub Process_Globals
    Dim urllist As List
    Dim geturl As String

End Sub

Sub Globals
    Private webview1 As WebView
    Private BtnStart As Button
    Private idx As Int
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")

End Sub

Sub BtnStart_Click
    idx=idx+1
    If idx=19 Then idx=0 'when your list has 20 items
    urllist = File.ReadList(File.DirAssets,"url.txt")
    geturl = (urllist.Get(idx))
    webview1.LoadUrl(geturl)

End Sub
 
Last edited:
Upvote 0

pemulanih

Member
Write exactly what your application should do ... because now it is not clear ...
ok thx b4 for ur attention..
i want when i click button (BtnStart_Click) webview will load url inside list of url.txt until end of line automaticly step by step (success confirmed loadpage). but in 1 webview, its possible? or need timer or just need some code just like looping or repeat task?
 
Upvote 0
Top