Tried to align imageview to right.. code crashes. why? 

UPDATED: Here is all row im having problem with. I think i failed on determining layouts somewhere here

```
    TableRow tableRow1 = new TableRow(this);
                tableRow1.setLayoutParams(new TableRow.LayoutParams(
                        TableRow.LayoutParams.MATCH_PARENT,
                        TableRow.LayoutParams.WRAP_CONTENT));

                tl.addView(tableRow1);

                /* textView1 */
                TextView textView1 = new TextView(this);
                textView1.setLayoutParams(new TableRow.LayoutParams(
                        LayoutParam

s.MATCH_PARENT, LayoutParams.MATCH_PARENT));
                textView1.setText(names);

                tableRow1.addView(textView1);
                ImageView icon;
                icon = new ImageView(this);
                LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                        LinearLayout.LayoutParams.MATCH_PARENT,
                    LinearLayout.LayoutParams.WRAP_CONTENT);
                icon.setLayoutParams(params);

                // icon.setLayoutParams(params);
                icon.setImageResource(R.drawable.ic_done); //default value
                switch (value) {
                case "1":
                    icon.setImageResource(R.drawable.ic_done);
                    break;
                case "0":
                    icon.setImageResource(R.drawable.ic_bad);
                default:
                    break;
                }
                System.out.println("value : " + value);
                icon.setPadding(densityToPixels(13), 0, 0, 0);
                tableRow1.addView(icon);

```