Simple loop for Android -
i think simple , easy question , i'd help. have loop add text. question is, add textview + imageview per line?
imageview img = (imageview)dialog.findviewbyid(r.id.pasar); textview tv = (textview) dialog.findviewbyid(r.id.txtrecorrido21); tv.settext(""); (int x = 1; x < 2; x++) { tv.append("text1"); tv.append("text2"); }
regards!
if want use linearlayout: (and assuming dialog inflated layout)
int n = 10; //numberoftextandimages linearlayout l1 = (linearlayout) findviewbyid(r.id.l1); (int = 0; < n; i++) { view dialog= getlayoutinflater().inflate(r.layout.dialog1,null,false); imageview img = (imageview)dialog.findviewbyid(r.id.pasar); textview tv = (textview) dialog.findviewbyid(r.id.txtrecorrido21); (int x = 1; x < 2; x++) { tv.append("text1"); tv.append("text2"); } l1.addview(dialog); }
Comments
Post a Comment