vendredi 28 juillet 2017

Android Java Reflection plus Internationalization

I don't know if it is possible to accomplish this but I'd like to discuss the matter anyways. I have a very long profile screen with aprox. 25 rows:

enter image description here

I want to create this screen programmaticaly with ListView and Adapter. I managed to do it using reflection so I could use the attribute name to the left as the field label, but that's not enough - as you can see, the app is currently in pt-BR but I also need it in en-US.

This is my class:

public class UserGeneralData {
@SerializedName("login")
private String login;

@SerializedName("name")
private String name;

@SerializedName("surname")
private String surname;

@SerializedName("mail")
private String mail;

@SerializedName("dateOfBirthday")
private String birthday;

@SerializedName("docCpf")
private String cpf;

@SerializedName("docRg")
private String identity;

@SerializedName("military")
private boolean military;
...

So, how can I change the language if I'm not using strings from the xml file?





Aucun commentaire:

Enregistrer un commentaire