need urgent help.
I create a dynamic Table with 7 TableRows.
So I will add to my TableRows RelativeLayouts and in them 3 ImageViews, so that I can align them.
But when I create a RelativeLayout and add into this RelativeLayout images,
I get an: IllegalStateExeption
- Code: Select all
The specified child already has a parent. You must call removeView() on child´s parent first.
My Code:
- Code: Select all
...
for(int i=0;i<3;i++){
tr = new TableRows(this);
tr.setId(...);
tr.setLayoutParams(new TableRow.LayoutParams....);
for(int k=0;k<3;k++){
rl = new RelativeLayout(this);
rl.setId(...);
...
iv = new ImageView(...);
iv.setId(..);
iv.setImgeResource(...);
rl.add(iv);
tr.add(rl);
}
table.addView(tr,....);
}
...
How can I solve this problem?
I need RelativeLayout to align my images.


