Android:Need to set Image before to TextView
<p>i need to set a image dynamically before to text view on the below mentioned code , so how to do this.?my code is below..</p>

<pre><code>if (attchStringArray.length &gt; 0) {                      
    LinearLayout attachemntLayout = new   LinearLayout(mainContext);
    LinearLayout.LayoutParams layoutParam  = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
    TextView attNameView = new TextView(mainContext);
    ImageView Ivbackground= new ImageView(mainContext);
    attNameView.setText(attchStringArray[2]);
    attachemntLayout.addView(attNameView,  layoutParam);            
    attachemntLayout.setBackgroundResource(R.drawable.bg_for_answers);
    attachmentsection.addView(attachemntLayout);
}
</code></pre>
