Sub BtnFiles_click
If File.Exists(File.Dirinternal&"/ABT/", "") = False Then File.MakeDir(File.Dirinternal&"/ABT/", "")
If File.Exists(File.Dirinternal&"/ABT/", "TempImage") = False Then File.Delete(File.Dirinternal&"/ABT/", "TempImage")
LoadIMG 'Takes user to file handler screen, user selects image to import
End Sub
Private Sub LoadIMG
Wait For (FileHandler1.LoadPNG) Complete (Result As LoadResult)
HandleLoadResult(Result)
End Sub
Private Sub HandleLoadResult(Result As LoadResult)
If Result.Success Then
Private in As InputStream
Private Out As OutputStream
Private byte1() As Byte
Private DirSource1 As String
Private TempPNG As Bitmap
Private LblH As Int = lblBTSLongLat.Height * 1.5
Filename1 = Result.RealName
DirSource1 = Result.Dir
'*******Gets file selected by FileHandler and stores it in DirInternal
If Filename1.EndsWith(".png") Then
byte1 = File.ReadBytes(DirSource1, Filename1) '************ This line causes the error.
in.InitializeFromBytesArray(byte1, 0, byte1.Length)
TempPNG.Initialize2(in)
Out = File.OpenOutput(File.Dirinternal&"/ABT/", "TempImage", False)
TempPNG.WriteToStream(Out, 100, "PNG")
Out.Close
'***************Image is now in internal memory folder as "TempImage"
'************ Now display image
ImgScreen.Top = LblH
ImgScreen.SetBackgroundImage(LoadBitmap(File.Dirinternal&"/ABT/", "TempImage"))
lblTitle2.Height = LblH
lblTitle2.Gravity = Gravity.CENTER_HORIZONTAL
lblTitle2.Text = Filename1
ListBack2.Height = LblH
ListBack2.Width = ListBack.Width
ListBack2.BringToFront
ListBack2.Visible = True
ListBackFlag = True
Else
toast.Show("Not a Valid file.")
End If
Else
toast.Show("No file loaded")
End If
End Sub