Android Code Snippet [B4X] Google Street View Get Picture

Alexander Stolte

Well-Known Member
Licensed User
With this Code you can get the picture of a Google Street View Position. Here you can check if is available.

B4X:
Sub getStreetViewPicture(width As Int, height As Int ,lat As Float, lon As Float)
   
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download("https://maps.googleapis.com/maps/api/streetview?size=" & width & "x" & height & "&location=" & lat & "," & lon)

    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
       
    myImageView.Bitmap = j.GetBitmap
       
    End If
   
    j.Release
   
End Sub

Have Fun with a new feature!
 
Last edited:

DonManfred

Expert
Licensed User
myImageView.Bitmap = j.GetBitmap
works in B4A and B4I but not in B4J.

In B4J it must be
B4X:
'Good example. Use.
Sub DownloadImage(Link As String, iv As ImageView)
   Dim job As HttpJob
   job.Initialize("", Me) 'note that the name parameter is no longer needed.
   job.Download(Link)
   Wait For (job) JobDone(job As HttpJob)
   If job.Success Then
     iv.SetImage (job.GetBitmap) 'replace with iv.Bitmap = job.GetBitmap in B4A / B4i
   End If
   job.Release
End Sub
 
Top