I have a 2-dim. array of ImageViews. They are set to a RelativeLayout programmatically. But when I start the App, they simply don't appear. This is my code:
private void setMap(ImageView[][] fields){
    RelativeLayout relLay = (RelativeLayout) findViewById(R.id.screen);
    OnClickListener listener = new MyOnClickListener();
    for (int i = 0; i < numFieldsHeight; i++){
        for (int j = 0; j < numFieldsWidth; j++){
            ImageView img = new ImageView(MapActivity.this);
            img.setImageResource(R.drawable.map);
            RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            if (j != 0)
                params.addRule(RelativeLayout.RIGHT_OF, fields[i][j-1].getId());
            else
                params.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
            if (i != 0)
                params.addRule(RelativeLayout.BELOW, fields[i-1][j].getId());
            else
                params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
            params.height = fieldLength;
            params.width = fieldLength;
            img.setVisibility(View.VISIBLE);
            img.setId(getFieldId(j,i));
            img.setOnClickListener(listener);
            fields[i][j] = img;
            relLay.addView(fields[i][j], params);
        }
    }
}
and
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#000000" >
    <RelativeLayout 
        android:id="@+id/relLayDiffSeekBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        ...
    </RelativeLayout>
    <RelativeLayout
        android:id="@+id/screen"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:background="#222222" >
    </RelativeLayout>
</RelativeLayout>
Further attributes of the RelativeLayout "screen" are set in code. But this works, I can see the RelativeLayout, just the ImageViews are missing.
There are no Exceptions thrown. Please help me!
------! Edit !------
I am very sorry, this code is actually working. The problem was that I forgot to set the variable fieldLength to something different from 0. Thank you very much for your help anyway! :)