the id is an intiger value not string: hope u ll get an idea from below code
while (ctr<3)
{
int layoutid;
if(ctr==1)
{ layoutid = R.id.AbsoluteLayout1;}
else{
layoutid = R.id.AbsoluteLayout2;}
mainlayout[ctr] = (AbsoluteLayout)findViewById(layoutid);
ctr++;
}
---------------------------------------------
all these won post an error as they are handled as int itself manipulate as you want you cant use this as it is as
int[] ctra={R.id.xx,R.id.xxx};
int i=0;
while (ctr<3)
{
mainlayout[i]=(AbsoluteLayout)findViewById(ctra[i]);
i++;}