I think the advice is to caution you not to do this for all of your UI elements everywhere, just as you don't use Java Reflection for all method calls. Looking a few things up by name in response to an activity start-up or a user interaction should not be a big deal.
On Feb 16, 7:30 am, Samuh <samuh.va...@gmail.com> wrote: > We have about 300 drawables/icons in our application and each drawable/ > icon is associated with an Id meaningful within the functional context > of our app. These icons are to be displayed in a Gallery and when the > user makes a selection, the relevant "Id" for the selected icon needs > to be passed to the backend server. > > Presently, inside getView of the Gallery Adapter, we are making use of > getResources().getIdentifier() to fetch appropriate icons since we > know only the names of the icons and their IDs. We DO NOT know their > resource ID. > > The official documentation discourages use of this API. Also, though > we have not yet instrumented our code, people have said this API and > also reflection is inefficient. > > Questions: > What are other alternatives that we can try? > How should such resources be bundled so that they can be addressed in > code efficiently? > > Thanks. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en