android dynamical binding

Posted by yoav.str on Stack Overflow See other posts from Stack Overflow or by yoav.str
Published on 2010-06-17T07:46:21Z Indexed on 2010/06/18 12:53 UTC
Read the original article Hit count: 334

Filed under:
|

I want to work dynamically therefore I want to bind text views dynamically I think an example would explain me the best

assuming I want to bind 7 image views i can do it like this :

 Country = (EditText)findViewById(R.id.CountryEditText);
 City = (EditText)findViewById(R.id.CityEditText);
 LivinigCreture = (EditText)findViewById(R.id.LivingCretureE);
 Nature =(EditText)findViewById(R.id.NatureEditText);
 Inanimate = (EditText)findViewById(R.id.InanimateEditText);
 KnowenPersonality = (EditText)findViewById(R.id.KnowenPersonalityEditText);
 Occupation = (EditText)findViewById(R.id.OccupationEditText);

but lets change 7 with NUMOFFILEDS as a final where i want to do the previous ?

   myImages = new ImageView [7];
   for (int i = 0; i<7;i++,????)
   myImages[i] = (ImageView)findViewById(R.id.initialImageView01);

notice : in my R file the R.id.initialImageView01 - R.id.initialImageView07 are not generate in a cont gap between them therefore I don't know how to make this architecture possible . and if there's a way can someone show me an example how to work dynmiclly (like using jsp on android combined way or something ?)

id its possiable to do so constant times is it possible to build an the same xml constant num of times like jsp does
thank u pep:)

© Stack Overflow or respective owner

Related posts about android

Related posts about android-widget