LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams param =
new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
ImageView image = new ImageView(this);
image.setBackgroundResource(R.drawable .icon);
layout.addView(image, param);
TextView text;
text = new TextView(this);
text.setText("textview");
layout.addView(text, param);
setContentView(layout);
layout.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams param =
new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
ImageView image = new ImageView(this);
image.setBackgroundResource(R.drawable .icon);
layout.addView(image, param);
TextView text;
text = new TextView(this);
text.setText("textview");
layout.addView(text, param);
setContentView(layout);