I started developing an Android App and I am wondering:
- Is it possible to parametrize a TextView? I want to render a text message which states something like: "The user age is 38". Lets suppose that the user age is the result of an algorithm. Using some typical i18n framework I would write in my i18n file something like "The user age is {0}". At run time I would populate parameters accordingly. I haven't figured out how to do this or similar in Android.
- Let's suppose I have a complex object with many fields. Eg: PersonModel which has id, name, age, country, favorite video game, etc. If I want to render all this information into a single layout in one of my activities the only way I have found is getting all needed TextViews by id and then populate them one by one through code. I was wondering if there is some mapping / binding mechanism in which I can execute something like: render(myPerson, myView) and that automatically through reflection each of the model properties get mapped into each of the TextViews. If someone has ever worked with SpringMVC, I'm looking for something similar to their mechanism to map domain objects / models to views (e.g. spring:forms).
Source: View source