The specified child already has a parent. You must call removeView() on the childs parent first

57

The specified child already has a parent. You must call removeView() on the child's parent first -

// TEXTVIEW
if(tv.getParent() != null) {
    ((ViewGroup)tv.getParent()).removeView(tv); // <- fix
}
layout.addView(tv); //  <==========  ERROR IN THIS LINE DURING 2ND RUN
// EDITTEXT

Comments

Submit
0 Comments