0
Hello,
I have an application that I need to send data of a Activity
to another Activity
. I tested several ways however all failed, but in another project one code worked normally, but in my current one did not. Can it be a logic or sequence error of the codes? I need to send the value of Byte
1 or 2, of Activity Main
to the DemE
. Follow the code below.
Activitymain:
public void onClick(View arg0) {
Byte valor = 1;
Intent intent = new Intent(Main.this, DemE.class);
Bundle params = new Bundle();
params.putByte("dado", valor);
intent.putExtras(params);
startActivity(intent);
}
Activitydeme:
Intent intent = getIntent();
Bundle params = intent.getExtras();
Byte valor = params.getByte("dado");
Toast.makeText(DemE.this, "valor" + valor, Toast.LENGTH_LONG).show();
I used the Toast
to test if the values were being received, however the value was returned as null
.
Thank you!