I am able to reproduce the error.

Following situation:

The layout of a list view row is defined as followed:


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android";
  android:layout_height="wrap_content" android:id="@+Id/row"
android:layout_width="match_parent" android:weightSum="15"
android:orientation="horizontal">
    <CheckBox android:id="@+Id/checkbox" android:layout_weight="1"
android:layout_width="0dip" android:layout_height="wrap_content"></CheckBox>
    <TextView android:layout_weight="3" android:layout_width="0dip"
android:id="@+Id/name1" android:layout_height="wrap_content"
android:text="Name"></TextView>
    <TextView android:layout_weight="1" android:layout_width="0dip"
android:id="@+Id/name2" android:layout_height="wrap_content"></TextView>
    <LinearLayout android:layout_height="wrap_content"
android:layout_width="0dip" android:layout_weight="10"
android:orientation="vertical" android:id="@+Id/grid"></LinearLayout>
</LinearLayout>


The linear layout (grid) has to be filled dynamic - it depends on the amount
of data items. Hence the view is produced somehow in the GetView method of
an adapter.

The view which is added to the linear layout is like a grid. A similar code
like the following is used to create this layout. This layout is added to
the linear layout (grid) of the list view row by calling AddView(layout);:


var layout = new LinearLayout(this.context)
    {
        Orientation = Orientation.Vertical, 
        WeightSum = rows
    };

for (int row = 0; row < rows; row++)
{
    var view = new LinearLayout(this.context)
        {
            Orientation = Orientation.Horizontal, 
            WeightSum = columns
        };

    var layoutParameters = new LinearLayout.LayoutParams(0,
ViewGroup.LayoutParams.MatchParent, 1f);

    for (int i = 0; i < columns; ++i)
    {
        view.AddView(
            new NoteTextView(this.context)
                {
                    LayoutParameters = layoutParameters,
                    Gravity = GravityFlags.CenterHorizontal,
                    Text = "My text"
                });
    }

    layout.AddView(view, row);
}


This code is executed several times but after some time it crashes at line
*layout.AddView(view);*. A try catch around this line does not work - no
exception. The application crashes with the log messages I posted before.

Did I make a mistake? Or is this a problem of Mono for Android? Does anyone
has any idea?

Best 
Andi

--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/App-crashes-tp4642075p4643594.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to