How to switch activity with item specific data sent
<p>I've had a look around, and it might be because I'm not sure what I'm looking for, but I can't find out how to do something I presume should be quite easy with android.</p>

<p>I have an array of data to display on the screen. This data is a class that holds a database key, name and image.</p>

<p>I'm currently displaying this data as an ImageView and a TextView. I loop through the array and add a new row to a TableLayout containing the image and text.</p>

<p>I'd like both the image and text to be clickable, changing to a new activity.</p>

<p>This new activity needs to know the database key of the row clicked in order to display the correct data.</p>

<p>Here's what I have so far:</p>

<pre><code>private void fillSuggestionTable(TableLayout tabSuggestions, Suggestion[] arrToAdd)
{
    for(int i = 0; i &lt; arrToAdd.length; i++)
    {
        /* Create a new row to be added. */
        TableRow trSuggestion = new TableRow(this);
        trSuggestion.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));

        /* Create objects for the row-content. */
        ImageView imgDisplayPicture = new ImageView(this);
        ImageHandler.loadBitmap(arrToAdd[i].strImageURL, imgDisplayPicture);
        imgDisplayPicture.setLayoutParams(new LayoutParams(50,50));

        TextView txtArtistName = new TextView(this);
        txtArtistName.setText(arrToAdd[i].strName);
        txtArtistName.setTextColor(Color.parseColor("#000000"));

        /* Add data to row. */
        trSuggestion.addView(imgDisplayPicture);
        trSuggestion.addView(txtArtistName);

        /* Add row to TableLayout. */
        tabSuggestions.addView(trSuggestion, new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    }
}
</code></pre>
