I'm a beginner, and I have the following question:
I'm inserting text from a EditText
into a array
, and I want to get it in another. I'm doing the following:
String[] pedidos = new String[11];
And then, when you click the "save" button, this happens:
public void onClick(View v) {
if(v.getId() == R.id.btnFinalizar){
pedidos[0] = edtPedido.getText().toString(); //insiro dados do EditText em uma array.
Intent intent = new Intent(mesa1.this, inicio.class);
intent.putExtra("pedidos1", pedidos[0]);
startActivity(intent);
}
}
And on the screen where I want to receive the data, I do this:
String[] pedidosFeitos = new String[11];
Intent intent = getIntent();
pedidosFeitos[0] = String.valueOf(intent.getStringArrayExtra("pedidos1"));
Note: I did not understand: String.valueOf(intent.getStringArrayExtra
I researched to the fullest, and ended up trying what Android Studio suggested.