Thanks :) That's definitely what I need.
Regards Larry/Xiangqian.liu On Sun, Oct 11, 2009 at 8:10 PM, Mark Murphy <[email protected]> wrote: > > Larry.Liu wrote: >> Is there any method to get one view by name rather than it's ID? >> because we are composing a common lib, and it's not able for us to >> know the Resource ID at this time, >> >> So is there any method to get one view by name, not by findViewById? > > getResources().getIdentifier() can get you the R.id.* value by name, > which you can then use in findViewById(). Reports indicate that > getIdentifier() is not terribly fast, so you may wish to cache the > results of the lookup somewhere if possible. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://twitter.com/commonsguy > > Need Android talent? Ask on HADO! http://wiki.andmob.org/hado > > > > --~--~---------~--~----~------------~-------~--~----~ 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] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

