Android Question Loadbitmap directly off of a file share

MrKim

Well-Known Member
Licensed User
Longtime User
Is there any way to load an image file directly off of a file share or must it be copied local first?

Below are the various things I tried to "Cheat" the system and the err reported. I had high hopes for the third one ("//MyServer/MyDir/Images/740-20426-00.jpg") as this is the spec passed to copy the file local, but no matter how many '////' I put on the front of it it stripped it down to one.

B4X:
        B = LoadBitmap("\\MyServer\MyDir\Images", "740-20426-00.jpg")
java.io.FileNotFoundException: \\MyServer\MyDir\Images\/740-20426-00.jpg (No such file or directory)

        B = LoadBitmap("", "\\MyServer\MyDir\SK_Images\740-20426-00.jpg")

java.io.FileNotFoundException: \\MyServer\MyDir\Images\740-20426-00.jpg (No such file or directory)

        B = LoadBitmap("", "//MyServer/MyDir/Images/740-20426-00.jpg")

java.io.FileNotFoundException: /MyServer/MyDir/Images/740-20426-00.jpg (No such file or directory)

Thanks for your input.
 
Last edited:

MrKim

Well-Known Member
Licensed User
Longtime User
It is not possible. You need to use the SMB library to download the images first.
Yes, that is what I am doing. The problem is that puts possibly proprietary data on a portable device....
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
You can use SMB.DownloadFile2 and pass an OutputStream that was initialized with out.InitializeToBytesArray. This way the image will never be stored on the file system.
Sigh, but that will not work with LoadBitmapSample will it? I am populating a listview and customer files may be large.
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
No. You will need to save it to a temporary file for this. If you are using B4A v7.30+ then you can use Bitmap.Resize to create a thumbnail from the large bitmap.
I have 7.01 but have not received notifications of anything newer. B4J and B4R, yes, but not B4A.
 
Upvote 0
Top