I have to admit I dont really understand many things about this.
This is more of a problem for Custom Dialogs than any others, but you never know.
So when a CustomDialog is visible, and then the Home key is pressed, the modal dialog needs to be removed. I am not sure how B4A handles it from here. Does it just exit the current sub, or does it kill the dialog and return DialogResponse.Cancel and the code is allowed to run through?
Either way, when I start my app again and invoke the same sub again, I get an error: IllegalStateException: The specified child already has a parent. You must call removeView() on the childs parent first.
This means that customLV is still a child of the custom dialog, but isnt the custom dialog destroyed since it is a local variable?
...or maybe I am missing something basic here again...
This is more of a problem for Custom Dialogs than any others, but you never know.
B4X:
Sub UploadFile
Dim cd As CustomDialog
retPath = File.DirRootExternal
Populatelv(retPath,customLV,LVFolderOnly)
cd.AddView(customLV,2dip,0,90%x-4dip,65%y)
fdresp = cd.Show("Select File to upload","Select","Cancel","",Null)
If fdresp = -3 Then Return
If File.IsDirectory(DB.GetParentPath(retPath),DB.GetFileName(retPath))= True Then
ToastMessageShow("No file is selected", False)
Log("Directory was selected instead of file")
Return
End If
ToastMessageShow(DB.GetFileName(fname) & " will be uploaded shortly",False)
End Sub
So when a CustomDialog is visible, and then the Home key is pressed, the modal dialog needs to be removed. I am not sure how B4A handles it from here. Does it just exit the current sub, or does it kill the dialog and return DialogResponse.Cancel and the code is allowed to run through?
Either way, when I start my app again and invoke the same sub again, I get an error: IllegalStateException: The specified child already has a parent. You must call removeView() on the childs parent first.
This means that customLV is still a child of the custom dialog, but isnt the custom dialog destroyed since it is a local variable?
...or maybe I am missing something basic here again...