android fragment reuse layout created in onCreateView again -
i create layout in oncreateview of fragment (say fraga) first time called , store in member variable (say viewa). push fragment (say fragb) on top of , after work press button. causes fraga'a oncreateview called again. if return saved member variable (viewa) exception thrown saying 'the specified child has parent. must call removeview() on child's parent first'. question that, there no other way re-use layout without inflating new instance
i think yes, need create new instance, because save context in fragment. illegalestateexception,for example same exception if called twice setcontentview() method. maybe call removeview() or removeallviews() works.
Comments
Post a Comment