I am trying to open a downloaded file with a default app...
the file is downloaded to Internaldir SUCCESSFULLY
then when trying to copy to external fails :
java.io.FileNotFoundException: /storage/emulated/0/Android/data/taxnow23.progressivegm/files/Pictures/7f41898546d300b08f36b9e96abbbc37973db20f.jpg: open failed: ENOENT (No such file or directory)
the file is downloaded to Internaldir SUCCESSFULLY
then when trying to copy to external fails :
java.io.FileNotFoundException: /storage/emulated/0/Android/data/taxnow23.progressivegm/files/Pictures/7f41898546d300b08f36b9e96abbbc37973db20f.jpg: open failed: ENOENT (No such file or directory)
B4X:
dim f as string ="http://xxx.xxx./picture.jpg" ' file is successfully downloaded
Dim dirx As String = File.DirInternal
Dim job As HttpJob
job.Initialize("", Me)
job.Download(f)
Wait For (job) JobDone(job As HttpJob)
If job.Success Then
Dim out As OutputStream = File.OpenOutput(dirx, newname, False)
File.Copy2(job.GetInputStream, out)
out.Close '<------ very important
If (File.Exists(dirx,newname)) Then
Log ("file exist")
File.Copy(dirx,newname,File.DirDefaultExternal,"Pictures/" & newname) ' <------ ERROR
End If
Else
Log("Error: " & job.ErrorMessage)
End If
job.Release
Last edited: