I' m trying to add my custom PostLayout class, it adds first one but after that it crashes with this error;
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
FragmentPostLayout = (LinearLayout) view.findViewById(R.id.HomeFragmentGenerateLayout);
PostLayout postlayout = new PostLayout(context);
for(int i = 0; i < 10; i++)
FragmentPostLayout.addView(postlayout, i - 1);//where it crashes when i=1