CustomDialog and HOME button

basil99

Active Member
Licensed User
Longtime User
Hi!

My code use CustomDialog with panel holding some views. When I tap HOME button and then go back to application, CustomDialog vanished, but any later call of CustomDialog fires an error message:

java.lang.illegalstateexcaption: the specified child already has a parent. you must call removeView() on the child's parent first
Code is:

B4X:
result = MyDialog.Show( captionString, "Ок", "Cancel","", Null )

and panel with different views was Initialized before in this way:

B4X:
MyDialog.AddView( MyPanel, 0, 0, 100%x, 100%y )

So, all works fine, exept this.
What I need to do to prevent this error message ?
Thank you
 

basil99

Active Member
Licensed User
Longtime User
call remove view before you add the views again.

Sent from my GT-I9305 using Tapatalk 2

Remove what view ? My Panel ? Like that ?

B4X:
MyDialog.AddView( MyPanel, 0, 0, 100%x, 100%y )
result = MyDialog.Show( captionString, "Ок", "Cancel","", Null )
MyPanel.RemoveView

correct ?
 
Upvote 0

basil99

Active Member
Licensed User
Longtime User
well, tried code above, but got the same error. But this seems works fine:

B4X:
MyPanel.RemoveView
MyDialog.AddView( MyPanel, 0, 0, 100%x, 100%y )
result = MyDialog.Show( captionString, "Ок", "Cancel","", Null )

Thanks for the idea !
 
Last edited:
Upvote 0
Top