Dynamically creating Table Rows for a table
<p>I'm trying to populate a highscores table for my game from data stored on the device's SD card.</p>

<p>Here is my <code>LeaderboardActivity.java</code>:</p>

<pre><code>public class LeaderboardActivity extends Activity {
private Leaderboard leaderboard;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_leaderboard);

    TableLayout highscoresTable = (TableLayout) findViewById(R.id.highscoresTable);
    this.leaderboard = new Leaderboard();

    ArrayList&lt;Player&gt; players = leaderboard.getScores();
    if(!(players==null))
    {
        Collections.sort(players);

        for(Player p:players)
        {
            TableRow newRow = new TableRow(this);
            TextView name = new TextView(this);
            TextView time = new TextView(this);

            name.setText(p.getName());
            name.setGravity(Gravity.CENTER_VERTICAL);
            name.setPadding(15, 0, 15, 0);
            time.setText(p.getTime());
            time.setGravity(Gravity.CENTER_VERTICAL);
            time.setPadding(15, 0, 15, 0);

            newRow.addView(name);
            newRow.addView(time);
            highscoresTable.addView(newRow);
        }
        setContentView(highscoresTable);
    }
    else
    {
        Log.i("DEBUG", "players is equal to null!");
    }
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.activity_leaderboard, menu);
    return true;
}
}
</code></pre>

<p>Here is my XML <code>activity_leaderboard.xml</code>:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background"
android:orientation="horizontal" &gt;
</code></pre>

<p></p>

<pre><code>&lt;TableLayout
    android:id="@+id/highscoresTable"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="15dp" &gt;

    &lt;TableRow
        android:id="@+id/headerRow"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical|fill_horizontal"
        android:showDividers="middle" &gt;

        &lt;TextView
            android:text="NAME"
            android:gravity="center_vertical"
            android:padding="15dp"&gt;
        &lt;/TextView&gt;

        &lt;TextView
            android:gravity="center_horizontal|center_vertical"
            android:padding="15dp"
            android:text="TIME" /&gt;

    &lt;/TableRow&gt;

    &lt;TableRow
        android:id="@+id/testRow"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" &gt;

        &lt;TextView
            android:text="TEST"
            android:gravity="center_vertical"
            android:paddingLeft="15dp"
            android:paddingRight="15dp"&gt;
        &lt;/TextView&gt;

        &lt;TextView
            android:gravity="center_horizontal|center_vertical"
            android:paddingLeft="15dp"
            android:paddingRight="15dp"
            android:text="NOT REAL" /&gt;

    &lt;/TableRow&gt;


&lt;/TableLayout&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>For some reason when I run my leaderboard it causes a <code>RuntimeException</code></p>

<p>How can I get this working?</p>

<hr>

<h3>UPDATE</h3>

<p>As requested, here's my log: </p>

<pre><code>03-29 13:45:41.136: E/AndroidRuntime(9894): FATAL EXCEPTION: main
03-29 13:45:41.136: E/AndroidRuntime(9894): java.lang.RuntimeException: Unable to start activity ComponentInfo{*.*.*.*/*.*.*.*.LeaderboardActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x77
03-29 13:45:41.136: E/AndroidRuntime(9894):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
03-29 13:45:41.136: E/AndroidRuntime(9894):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-29 13:45:41.136: E/AndroidRuntime(9894):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-29 13:45:41.136: E/AndroidRuntime(9894):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-29 13:45:41.136: E/AndroidRuntime(9894):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-29 13:45:41.136: E/AndroidRuntime(9894):     at android.os.Looper.loop(Looper.java:123)
03-29 13:45:41.136: E/AndroidRuntime(9894):     at android.app.ActivityThread.main(ActivityThread.java:4627)
03-29 13:45:41.136: E/AndroidRuntime(9894):     at java.lang.reflect.Method.invokeNative(Native Method)
03-29 13:45:41.136: E/AndroidRuntime(9894):     at java.lang.reflect.Method.invoke(Method.java:521)
03-29 13:45:41.136: E/AndroidRuntime(9894):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-29 13:45:41.136: E/AndroidRuntime(9894):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-29 13:45:41.136: E/AndroidRuntime(9894):     at dalvik.system.NativeStart.main(Native Method)
03-29 13:45:41.136: E/AndroidRuntime(9894): Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x77
03-29 13:45:41.136: E/AndroidRuntime(9894):     at android.content.res.Resources.getText(Resources.java:201)
03-29 13:45:41.136: E/AndroidRuntime(9894):     at android.widget.TextView.setText(TextView.java:2817)
03-29 13:45:41.136: E/AndroidRuntime(9894):     at *.*.*.*.LeaderboardActivity.onCreate(LeaderboardActivity.java:44)
03-29 13:45:41.136: E/AndroidRuntime(9894):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-29 13:45:41.136: E/AndroidRuntime(9894):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-29 13:45:41.136: E/AndroidRuntime(9894):     ... 11 more
</code></pre>
