Gijsen Member Licensed User Longtime User Oct 19, 2015 #1 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.
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.
R Roycefer Well-Known Member Licensed User Longtime User Oct 19, 2015 #2 Can you post the stack trace of the crash? Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Oct 20, 2015 #3 It probably runs out of memory. Use LoadBitmapSample instead. Upvote 0
Gijsen Member Licensed User Longtime User Oct 20, 2015 #4 I'll try LoadBitmapSample. I think the problem is related to my other post where the image is saved. http://b4x.com/android/forum/threads/file-dir-error-compiling-expression.59491/ Is there a way to catch the error thrown by LoadBitmap if it fails for whatever reason ? Upvote 0
I'll try LoadBitmapSample. I think the problem is related to my other post where the image is saved. http://b4x.com/android/forum/threads/file-dir-error-compiling-expression.59491/ Is there a way to catch the error thrown by LoadBitmap if it fails for whatever reason ?
Erel B4X founder Staff member Licensed User Longtime User Oct 20, 2015 #5 The first step is to check the logs and post the error message. Upvote 0
Gijsen Member Licensed User Longtime User Oct 20, 2015 #6 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.FILLEnd If bannerTimer.Enabled = True Thank you all for your patience and help. Upvote 0
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.FILLEnd If bannerTimer.Enabled = True Thank you all for your patience and help.