I have 3 XML files in my resources, these are:
<resources>
<string-array name="nombres">
<item>Ivan</item>
<item>Jose</item>
...
</string-array>
...
</resources>
<resources>
<string-array name="apellidos">
<item>More</item>
<item>Flores</item>
...
</string-array>
...
</resources>
<resources>
<string-array name="correos">
<item>gmail.com</item>
<item>hotmail.com</item>
...
</string-array>
...
</resources>
Then I have my Activity with the following code:
public class Registro extends AppCompatActivity implements View.OnClickListener {
private TextView Nombre,Apellido,Correo;
private Button Generar;
//Sacamos los
private String[] names = getResources().getStringArray(R.array.nombres);
private String[] apellios = getResources().getStringArray(R.array.apellidos);
private String[] correo = getResources().getStringArray(R.array.correos);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registro);
//Seteamos las Cajas de Texto
Nombre = (TextView) findViewById(R.id.txtNombre);
Apellido = (TextView) findViewById(R.id.txtApellido);
Correo = (TextView) findViewById(R.id.txtCorreo);
Generar = (Button) findViewById(R.id.btnGenerar);
//Ponemos en Modo de Escucha al Boton
findViewById(R.id.btnGenerar).setOnClickListener(this);
}
@Override
public void onClick(View v) {
}
}
My Problem arises from how to generate a randon of these 3 XML and put it in a text box.
This is my application model: