Android Question open image/txt on Lan (PC)

Tayfur

Well-Known Member
Licensed User
Longtime User
Hello;
I am new start it.
I dont know, how is open image on Lan Pc. (Like ES explorer)

for example :
image file "\\server\picture\sample.jpg" (in Server Pc)

(smb://192.168.1.222)
Server ip : 192.168.1.222
User : xxxx
Pasword : zzzz


Please send to me easy way or sample. thank you for your helps...
 

Tayfur

Well-Known Member
Licensed User
Longtime User
You should use the SMB library for that.
http://www.b4x.com/search?query=SMB

Hi;
Thank you for your helps. I do a lot of thing.
So, I have some problem.
SMB1.DownloadFile("smb://192.168.1.222/KALITE_RAPOR/", "logo.jpg", File.DirRootExternal,"logo.jpg")

its work. But this way record the file on phone.
I want to use the stream. How I can?


I have problem lines in "SMB1_DownloadCompleted".

(sorry I am new...)



B4X:
Sub SMB1_ListCompleted(Url As String, Success As Boolean, Entries() As SMBFile)
  If Not(Success) Then
      Log(LastException)
  Else
      For i = 0 To Entries.Length - 1
        Log("*****************")
        Log(Entries(i).Name)
        Log(Entries(i).Directory)
        Log(DateTime.Date(Entries(i).LastModified))
        Log(Entries(i).Parent)
        Log(Entries(i).Size)
      Next
  End If

  'SMB1.DownloadFile("smb://192.168.1.222/KALITE_RAPOR/", "logo.jpg", File.DirRootExternal,"logo.jpg") '****its work
sout.InitializeToBytesArray(1000) ' Declared >> Dim sout as outputstream ***************
  SMB1.DownloadFile2("smb://192.168.1.222/KALITE_RAPOR/", "logo.jpg",sout,True)
  
End Sub

B4X:
Sub SMB1_DownloadCompleted (Url As String, RemoteFile As String, Success As Boolean)
  If Not(Success) Then
      ToastMessageShow("Download failed : " & LastException,False)
  Else
        ToastMessageShow("Download : " & RemoteFile & " downloaded",False)
        ToastMessageShow(File.DirRootExternal & "logo.jpg", False)
        'ImageView1.Bitmap = LoadBitmap(File.DirRootExternal, "logo.jpg") '///----its work
        Dim photo As Bitmap
        photo.Initialize3(ImageView1.Bitmap)
        photo.WriteToStream(sout, 10, "JPEG")
        'ImageView1.WriteToStream(sout, 100, "JPEG")' OutputStream1, 10, "JPEG")
        ImageView1.Bitmap= Bitmap.WriteToStream(sout, 10, "JPEG")
    End If  
End Sub
 
Upvote 0
Top