Set<String> keys = ModuleName.keySet();
String[] values = new String[N];
int i = 0;
for (String key : keys) {
values[i] = ModuleName.get(key);
i++;
}
for (int i=0;i<values .length;i++)
{
final int index =i;
LinearLayout child_insidenew_layout = new LinearLayout(this);
child_insidenew_layout.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout.LayoutParams child_inside_paramsnew = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
child_insidenew_layout.setLayoutParams(child_inside_paramsnew);
child_insidenew_layout.setGravity(Gravity.CENTER_VERTICAL);
child_insidenew_layout.setBackgroundResource(R.drawable.layout_selector);
TextView textview = new TextView(this);
LinearLayout.LayoutParams image_params = new LinearLayout.LayoutParams(imageWidth,imgHeight);
image_params.setMargins(margin,margin, margin, margin);
child_insidenew_layout.addView(textview, image_params);
TextView textrootname = new TextView(getActivity());
LinearLayout.LayoutParams TextView_params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
textrootname.setSingleLine(true);
textrootname.setEllipsize(TruncateAt.MARQUEE);
textrootname.setFocusableInTouchMode(true);
textrootname.setFreezesText(true);
textrootname.setMarqueeRepeatLimit(-1);
textrootname.setFocusable(true);
textrootname.setSelected(true);
textrootname.settext("values indeax of i" )
textrootname.setGravity(Gravity.CENTER);
textrootname.setTextColor(Color.BLACK);
textrootname.setTextSize(15);
child_insidenew_layout.addView(textrootname, TextView_params);
child_inside_layout.addView(child_insidenew_layout, child_inside_paramsnew);
}