Hi,

You could also find by id the container of all the children you need
and iterate over its children using getChildCount() and getChildAt().

Note that there is also a way to get an id's integer using its name as
a String. Use Context.getResources().getIdentifier():

http://code.google.com/android/reference/android/content/res/Resources.html#getIdentifier(java.lang.String,%20java.lang.String,%20java.lang.String)

2008/9/4 Mark Murphy <[EMAIL PROTECTED]>:
>
> Kavi wrote:
>> Currently, findViewById uses a R.id.viewid which is an Integer to find
>> views.
>>
>> Is it possible to give findViewById a string like "R.id.field_1_text"?
>>
>> The reason i want to know this is then, i can use a loop and change
>> the values for fields like
>> R.id.field_1_text, R.id.field_2_text, R.id.field_3_text .... rather
>> than setting all of them sequentially.
>
> Why not put them in an array?
>
> private int[] ALL_YOUR_TEXT={R.id.field_1_text, R.id.field_2_text, ...};
>
> Then you can iterate over them as you wish.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com
> _The Busy Coder's Guide to Android Development_ Version 1.1 Published!
>
> >
>



-- 
Romain Guy
www.curious-creature.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to