Can anyone see what is wrong with the below:

```
                if (mViewPager.getCurrentItem() == 3){
                TableLayout tbl = (TableLayout)findViewById(R.id.tblHistory);

                if (tbl.getChildCount() != mExceptions.size()){

                    for (int i = tbl.getChildCount(); i < mExceptions.size(); i++){
                        GPSException e = mExceptions.get(i);

                        //TableRow
                        TableRow tr = new TableRow(this);
                        tr.setLayoutParams(new TableRow.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
                        tr.setBackgroundColor(Color.BLACK);

                        //DateTime
                        TextView tx = new TextView(this);
                        tx.setLayoutParams(new android.view.ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
                        tx.setText(e.DateTime);
                        tx.setTextAppearance(getApplicationContext(), android.R.attr.textAppearanceMedium);
                        tx.setTextColor(Color.BLACK);
                        tx.setBackgroundColor(Color.WHITE);
                        tr.addView(tx);

                        //Speed
                        tx = new TextView(this);
                        tx.setLayoutParams(new android.view.ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
                        tx.setText(Float.toString(e.Speed));
                        tx.setTextAppearance(getApplicationContext(), android.R.attr.textAppearanceMedium);
                        tx.setTextColor(Color.BLACK);
                        tx.setBackgroundColor(Color.WHITE);
                        tr.addView(tx);

                        //Bearing
                        tx = new TextView(this);
                        tx.setLayoutParams(new android.view.ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
                        tx.setText(Double.toString(e.Degrees));
                        tx.setTextAppearance(getApplicationContext(), android.R.attr.textAppearanceMedium);
                        tx.setTextColor(Color.BLACK);
                        tx.setBackgroundColor(Color.WHITE);
                        tr.addView(tx);

                        //Exceptions
                        tx = new TextView(this);
                        tx.setLayoutParams(new android.view.ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
                        tx.setText(e.ExceptionString());
                        tx.setTextAppearance(getApplicationContext(), android.R.attr.textAppearanceMedium);
                        tx.setTextColor(Color.BLACK);
                        tx.setBackgroundColor(Color.WHITE);
                        tr.addView(tx);

                        tbl.addView(tr, 0);
                    }

                    tbl.invalidate();
                    tbl.refreshDrawableState();
                }
            }

```

My class implements LocationListener and the above code is fired in the onLocationChanged event. The aim is to add a TableRow to a TableLayout for each queued "Exception". Each row is inserted at position 0.

I've tried everything apart from the correct approach it would appear!

My layout is as follows (resources not used for the time being, but will be once I've sorted out this issue - for all you eagle eyed viewers out there!):

```
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">

```

```
   <TableRow android:layout_width="match_parent" android:layout_height="wrap_content">
       <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Dt/Tm"></TextView>            
       <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Spd"></TextView>            
       <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Brg"></TextView>            
       <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Ex"></TextView>            
   </TableRow>
</TableLayout>

```

There are no exceptions thrown, and if I toast a short message in the for loop, it does appear.

If you need more info, not a problem.

Thanks.