android - ViewGroup.java AddViewInner issue -
i keep getting following errors, it's same error keeps occuring on different lines
fatal exception: java.lang.illegalstateexception: specified child has parent. must call removeview() on child's parent first. @ android.view.viewgroup.addviewinner(viewgroup.java:3883)
fatal exception: java.lang.illegalstateexception: specified child has parent. must call removeview() on child's parent first. @ android.view.viewgroup.addviewinner(viewgroup.java:4312)
fatal exception: java.lang.illegalstateexception: specified child has parent. must call removeview() on child's parent first. @ android.view.viewgroup.addviewinner(viewgroup.java:4310)
things have tried :-
while adding fragment add code in oncreateview
((viewgroup) view.getparent()).removeview(view); view = inflater.inflate(r.layout.create_carpool_layout, container, false); return view;
and inflate view
while inflating layouts / views in adapter make sure view removed parent view
i not sure causing problem
try double checking how inflating view.
there 2 possible ways:
passing parent inflater:
layoutinflater.from(context).inflate(r.layout.layout, this, true);
keep view without parent:
layoutinflater.from(context).inflate(r.layout.layout, null);
when using first method, cannot call addview()
view
parameter.
using second way, view not pinned parent, therefore can invoke addview()
Comments
Post a Comment