Android Question webview zoom

mohdsaks

Member
Licensed User
Longtime User
hii
and thank you for all your supporting
my question is am using webview to connect to my ip cam and everything was good and i can see the video streaming but i want the view to be zoomed out because its too zoomed in, i used this code
B4X:
Sub bed_room_camera


  Dim zoomed As Boolean

  Camera.LoadUrl("http://xxxx.xxx/xxx.htm")
  If zoomed = False Then
  For i = 0 To 10
      If Camera.Zoom(False) = True Then
      
        End If
      Next
      zoomed = True
    
End If


  Camera.ZoomEnabled = False





End Sub



it worked fine for awhile but when the page full loaded it became to the same size before
can you help me with any code or example for zoom out
 
Last edited:

mohdsaks

Member
Licensed User
Longtime User
thank you for your replay
am realy new with programming can you just show me in example what you mean .
 
Upvote 0

mohdsaks

Member
Licensed User
Longtime User
thank you very much for your support but i tried the pagefinishe event but i get that i may miss a library because of (as finished ) i think and if there is any other way to zoom out plz help me with it
 
Upvote 0

mohdsaks

Member
Licensed User
Longtime User
this is my full code with the website which i want to zoom out

B4X:
#Region  Project Attributes
    #ApplicationLabel: webview
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Dim WebView1 As WebView
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("Main")
      WebView1.LoadUrl("http://www.mytryout01.somee.com")
      WebView1.ZoomEnabled = True
 
 
    bed_room_camera




End Sub

Sub bed_room_camera

  Dim zoomed As Boolean
   
  zoomed = False
 
 
  If zoomed = False Then
  For i = 0 To 20
      If WebView1.Zoom(False) = True Then
       
        End If
      Next
      zoomed = True
     
  End If
 
 

End Sub



Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


hope anyone can help me with that
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User


B4X:
  If zoomed = False Then
  For i = 0 To 20
      If WebView1.Zoom(False) = True Then
      '??????????????????????????????????????????????????
        End If
      Next
      zoomed = True
   
  End If

I have not read the whole thread, I'll do it in a moment, but I noticed this and ...!
 
Upvote 0

mohdsaks

Member
Licensed User
Longtime User
that because i don't know what to put there and i don't know if what i did is right or wrong
and thank you in advance for your help you will save me really if you will find me the solution
 
Upvote 0

mohdsaks

Member
Licensed User
Longtime User
no my problem is i want the page to be zoomed out automatically because when i open that page with the webview its zoomed in too much and i can see only the logo then i have to zoom out to see the whole page for the website
 
Upvote 0

mohdsaks

Member
Licensed User
Longtime User
hi Erel i tried to use your code but without any luck actually maybe what i did all wrong can you just tell me exactly what i have to do with that code because i dont know how to use it and am really want to thank you for your helping
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
You haven't integrated the code I previously suggested...


I have integrated it :

B4X:
Sub WebView1_PageFinished (Url As String)
  Log("WebView1_PageFinished")
    Do While WebView1.Zoom(False) = True
      Log("zoom out") ' <--- this line is executed 7 times
      DoEvents ' probably it is not necessary
    Loop
End Sub

I tried to "invalidate" WebView1. Don't works fine
 
Upvote 0

mohdsaks

Member
Licensed User
Longtime User
thank you for ur help
i tried the code above but it is not working for zoom out but when i change the code like

B4X:
Sub WebView1_PageFinished (Url As String)
  Log("WebView1_PageFinished")
    Do While WebView1.Zoom(True) = True
      Log("zoom out") ' <--- this line is executed 7 times
      DoEvents ' probably it is not necessary
    Loop
End Sub

it is working and it is zoom in 7 times and i can see the log
also i noticed when i lunched the code that the zoom out button is not enabled i can only zoom in
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…