Android Question How to copy image file to Res folder

microbox

Active Member
Licensed User
Longtime User
Hi, I'm using Erel's tutorial on AsyncStreamsObject. When the drawing is received on the second device I need to copy it to a res folder (#AdditionalRes: ..\Res). The specific target location is (res\drawable)
B4X:
Sub astreamO_NewObject(Key As String, Value As Object)
    Select Key
        Case "image"
            Dim bmp As Bitmap = Value
            '------------------------------------------------------------
             File.Copy ???
            '------------------------------------------------------------
            Dim r As Rect
            r.Initialize(0, 0, pnlframe.Width, pnlframe.Height)
            imgbackframe.SetBackgroundImage(bmp)
            pnlframe.Invalidate
        Case "file"
            Dim fileName As String = Value
            Log("Received file. File size: " & File.Size(astreamO.TempFolder, fileName))
    End Select
End Sub

I appreciate any input.
 

Star-Dust

Expert
Licensed User
Longtime User
The folder is File.DirAssets but isn't possibile copy any file on runtime. Because after compiled isn't Real folder. Can olny to read.

When project can add file from B4A ide.
 
Upvote 0

microbox

Active Member
Licensed User
Longtime User
Hi Star-Dust, thanks for the info. I guess I need to move my files to a different folder.
 
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
File.DirAssets
The assets folder includes the files that were added with the file manager. These files are read-only. You can not create new files in this folder (which is actually located inside the apk file).
 
Upvote 0

microbox

Active Member
Licensed User
Longtime User
@DonManfred I'm using your great swipecardview, But I'm not sure if it is possible to move all files to another folder? Can I simply add the image to the card(without copying to a specific folder) when it is received? (I'm incorporating it with Erel's AsyncStreamsObject tutorial)

Thank you for the time.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…