Android Question Image from IP address - see it in Imageview

petr4ppc

Well-Known Member
Licensed User
Longtime User
Dear friends,

I am trying this

B4X:
' https://www.b4x.com/android/forum/threads/b4x-class-mjpeg-decoder.73702/#content
Sub Globals
    Dim ImageView3 As ImageView
    Dim ImageView2 As ImageView
    Dim ImageView1 As ImageView
    Dim ImageView4 As ImageView
    Private click As Button
    Private mj1 As MJPEG
End Sub

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

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)
    CallSub(ImageDownloader, "ActivityIsPaused")
End Sub


Sub click_Click
    mj1.Initialize(Me, "mj1")
    mj1.Connect("192.168.117.29/myimage", 80) 'this stream uses a non-standard port
End Sub

Sub mj1_Frame(bmp As B4XBitmap)
    ImageView1.SetBackgroundImage(bmp)
End Sub

I am using MJPEG module from B4J.
I have not result.
Please is it good way how to work with images which are available on some IP?
Please for advice,
thank you
p4ppc
 
Last edited:

aeric

Expert
Licensed User
Longtime User
I suggest you to look at

It is easier to download image from a link to imageview
B4X:
Sub DownloadImage(Link As String, iv As ImageView)
   Dim j As HttpJob
   j.Initialize("", Me)
   j.Download(Link)
   Wait For (j) JobDone(j As HttpJob)
   If j.Success Then
     iv.Bitmap = j.GetBitmap
   End If
   j.Release
End Sub
 
Upvote 0
Top