TableRow inside TableLayout cause segmentation fault?-Collection of common programming errors
I’m writing an android application using sdk 2.3.3.
I try using a TableLayout layout xml file with a TableRow inside it.
this is the layout file:
in my GameActivity onCreate() function i have the following code:
super.onCreate(savedInstanceState);
setContentView(R.layout.game);
till now I used a different xml layout file that contains a datagird that worked fine. but for some reason when I load this layout file i get a segmentation fault.
08-12 15:15:56.027: D/AndroidRuntime(1056): Shutting down VM
08-12 15:15:56.027: W/dalvikvm(1056): threadid=1: thread exiting with uncaught exception (group=0x40015560)
08-12 15:15:56.087: E/AndroidRuntime(1056): FATAL EXCEPTION: main
08-12 15:15:56.087: E/AndroidRuntime(1056): java.lang.ArithmeticException: divide by zero
08-12 15:15:56.087: E/AndroidRuntime(1056): at android.widget.TableLayout.mutateColumnsWidth(TableLayout.java:579)
08-12 15:15:56.087: E/AndroidRuntime(1056): at android.widget.TableLayout.shrinkAndStretchColumns(TableLayout.java:568)
08-12 15:15:56.087: E/AndroidRuntime(1056): at android.widget.TableLayout.measureVertical(TableLayout.java:466)
08-12 15:15:56.087: E/AndroidRuntime(1056): at android.widget.TableLayout.onMeasure(TableLayout.java:431)
08-12 15:15:56.087: E/AndroidRuntime(1056): at android.view.View.measure(View.java:8313)
08-12 15:15:56.087: E/AndroidRuntime(1056): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
08-12 15:15:56.087: E/AndroidRuntime(1056): at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
08-12 15:15:56.087: E/AndroidRuntime(1056): at android.view.View.measure(View.java:8313)
08-12 15:15:56.087: E/AndroidRuntime(1056): at android.widget.LinearLayout.measureVertical(LinearLayout.java:531)
08-12 15:15:56.087: E/AndroidRuntime(1056): at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
08-12 15:15:56.087: E/AndroidRuntime(1056): at android.view.View.measure(View.java:8313)
08-12 15:15:56.087: E/AndroidRuntime(1056): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
08-12 15:15:56.087: E/AndroidRuntime(1056): at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
08-12 15:15:56.087: E/AndroidRuntime(1056): at android.view.View.measure(View.java:8313)
08-12 15:15:56.087: E/AndroidRuntime(1056): at android.view.ViewRoot.performTraversals(ViewRoot.java:839)
08-12 15:15:56.087: E/AndroidRuntime(1056): at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
08-12 15:15:56.087: E/AndroidRuntime(1056): at android.os.Handler.dispatchMessage(Handler.java:99)
08-12 15:15:56.087: E/AndroidRuntime(1056): at android.os.Looper.loop(Looper.java:123)
08-12 15:15:56.087: E/AndroidRuntime(1056): at android.app.ActivityThread.main(ActivityThread.java:3683)
08-12 15:15:56.087: E/AndroidRuntime(1056): at java.lang.reflect.Method.invokeNative(Native Method)
08-12 15:15:56.087: E/AndroidRuntime(1056): at java.lang.reflect.Method.invoke(Method.java:507)
08-12 15:15:56.087: E/AndroidRuntime(1056): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-12 15:15:56.087: E/AndroidRuntime(1056): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-12 15:15:56.087: E/AndroidRuntime(1056): at dalvik.system.NativeStart.main(Native Method)
in general I want to have 4 tableRows and in each one to add 4 ImageViews.
what am I doing wrong ?
thanks!
Kfir