I have an application with very complex UI, containing many layouts nested one in another. While Creating another layout, I've caught a StackOverflowError
Wondering, I've created two test examples:
1) Hello world application with following xml for main Activity
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
    <FrameLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
        <FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >
            <!-- ...So on 30 times... -->
                <FrameLayout
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent" >
                </FrameLayout>
            <!-- ...So on 30 times... -->
        </FrameLayout>
    </FrameLayout>
</FrameLayout>
causes StackOverflowError while drawing the layout (cause every layout recursively draws it's children)
2) The following test case
public class TestOverflowActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        overflow(0);
    }
    private void overflow(int i){
        android.util.Log.i("Stack depth:", " = " + i);
        overflow(i+1);
    }
}
causes StackOverflowError on depth about 260-270 calls. 
Every call of stack element for second test case takes 4 bytes for return address + 4 bytes for parameter = 8 bytes. It's possible that Dalvik's VM keeps a bit more info in every element, but even 16 bytes per element * 260 calls = about 4Kbytes for maximum overall stack size. This does not seem enough.
Is there any way to increase maximum stack size?
 
     
     
     
    