Hi. I tried using MJPEG Class in B4A (copied from B4J example and modified to B4A) with a string written directly
B4X:
mj1.Connect("192.168.0.5/", 51042)
and it's working. But if I store that same string in a variable
B4X:
Dim ip as String = "192.168.0.5/"
mj1.Connect(ip, 51042)
Is not working. It just displays a blank screen, no error.
Any help is appreciated.
mj1 is defined in process_globals as MJPEG
and this is the Frame Sub
B4X:
Sub mj1_Frame(bmp as Bitmap)
ImageView1.Bitmap = bmp
End Sub
I used inputdialog for it from Dialogs Library. When input is returned I compared it like this for testing purposes:
B4X:
Dim ip as String = "192.168.0.5/"
If ip = "192.168.0.5/" Then
mj1.Connect("192.168.0.5/", 51042)
End If
And it entered the If Statement.
B4X:
Dim input As InputDialog
input.InputType = input.INPUT_TYPE_TEXT
Dim ans As Int = input.Show("Enter Server IP:", "IP", "OK", "", "Cancel", Null)
Dim ip As String
If ans = DialogResponse.POSITIVE Then
ip = input.Input
End If
If ip = "192.168.0.5/" Then
mj1.Connect("192.168.0.5/", 51042)
End If
Ok. For some reason is not working for me. I'll have to dig more. Thanks. I solved it using a hotspot and I know that Android's default IP is 192.168.43.1 I used it directly in code.