Class_Globals: Public rpTempDir As String
B4XPage_Created: rpTempDir = rp.GetSafeDirDefaultExternal("Temp")
........
Wait For CC_Result (Success As Boolean, Dir As String, FileName As String)
If Success Then
Dim FileCount As Int = 0
Dim CopyFileName As String = "Image" & FileCount & ".jpg"
Do While File.Exists(B4XPages.MainPage.rpTempDir, CopyFileName)
FileCount = FileCount + 1
CopyFileName = "Image" & FileCount & ".jpg"
Loop
File.Copy(Dir, FileName, B4XPages.MainPage.rpTempDir, CopyFileName)
........