Android Question Error in selecting file

devmobile

Active Member
Licensed User
I choose file from ContentChooser
When i select file from Astro app,it return error
Contentchooser return content://com.metago.astro.filecontent/file/file/storage/emulated/0/2.jpg for filename but GetPathFromContentResult cannot convert to valid path
 

devmobile

Active Member
Licensed User
Please post the relevant code and the error message from the logs.
B4X:
    Dim ou As OutputStream
ou = File.OpenOutput(File.DirInternal,"temp.jpg",False)
File.Copy2(File.OpenInput(Dir,FileName),ou)
ou.Close
When i use it,it get error NotFoundFile (file exist really)
 
Upvote 0

devmobile

Active Member
Licensed User
B4X:
Private Sub cc_Result (Success As Boolean, Dir As String, FileName As String)
   
    If Success Then
       
        dim filename_2 as string
        dim filename_2    =    GetPathFromContentResult(FileName)

        Dim ou As OutputStream
        ou = File.OpenOutput(File.DirInternal,"temp.jpg",False)
        File.Copy2(File.OpenInput(Dir,FileName),ou)
        ou.Close

    End if
End Sub
 
Upvote 0

devmobile

Active Member
Licensed User
B4X:
Private Sub cc_Result (Success As Boolean, Dir As String, FileName As String)
  
    If Success Then
      
        dim filename_2 as string
        dim filename_2    =    GetPathFromContentResult(FileName)

        Dim ou As OutputStream
        ou = File.OpenOutput(File.DirInternal,"temp.jpg",False)
        File.Copy2(File.OpenInput(Dir,FileName),ou)
        ou.Close

    End if
End Sub
In relevant code in previous post,when i select file from astro,in GetPathFromContentResult function it get error (because file not found)
 
Upvote 0
Top