Android Question imageView.Bitmap = LoadBitmap(File.DirInternal, fileName) crashes

Gijsen

Member
Licensed User
Longtime User
On android 5.02 my application works great.
On android 4.1 and 4.2 it crashes :(

First images are downloaded from the server, and saved to File.DirInteral.

Afterwards a check is in place to make sure the image is there.

If it's there I try to load it into an imageview and the application crashes with Android 4.1 and 4.2, but not with 5.02.
 
The problem was that the images I saved earlier from the download are corrupt.
By using this code they are complete and loading:

In JobDone:
​
Dim OutStream As OutputStream
Log("DownloadReady: " & bannerImageName)

File.Delete(File.DirInternalCache, bannerImageName)

OutStream = File.OpenOutput(File.DirInternalCache, bannerImageName, False)
Job.GetBitmap.WriteToStream(OutStream, 100, "PNG")
OutStream.Close
If File.Exists(File.DirInternalCache, bannerImageName) = True Then

imgBanner.Bitmap = LoadBitmapSample(File.DirInternalCache, bannerImageName, 600, 50)
imgBanner.Gravity = Gravity.FILL
​
End If
bannerTimer.Enabled = True



Thank you all for your patience and help.
 
Upvote 0
Back
Top