Android Question Show Image before loading of website

manzoor

Member
Kindly help me, I want this

If InterNet not Connected then
Show Message
else
Show Loading Image until Website Loaded
end
 

Brian Dean

Well-Known Member
Licensed User
Longtime User
Use the MLWifi library; this will tell you whether you are online (and if you are on WiFi) ...
B4X:
Sub Process_Globals
    Dim wiFi As MLwifi
    Dim router As Boolean
    Dim connected As Boolean
End Sub

Sub checkInternet
    router = wiFi.isWifiConnected
    connected = wiFi.isOnLine
End Sub
Showing a splash screen while a webpage loads is just programming. There are many ways of doing this - it will depend on your app design. That is up to you to choose, I think. Here is a very simple but not very elegant way to do it in B4XPages ...
B4X:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Private WebView1 As WebView
    Private ImageView1 As ImageView
End Sub

Public Sub Initialize
   
End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    ImageView1.Bitmap = LoadBitmap(File.DirAssets, "index.jpg")
    WebView1.Visible = False
    WebView1.LoadUrl("https://www.b4x.com/android/forum/forums/android-questions.26/")
End Sub

'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.

Sub WebView1_PageFinished (Url As String)
    WebView1.Visible = True
    ImageView1.Visible = False  
End Sub
 
Last edited:
Upvote 0

manzoor

Member
Great Brain...... Thanks a lot

You solved my big problem

Hopefully with your help I will learn Android Development in B4A
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…