Hello,
I have an application that I need to send data from a Activity
to another Activity
. I tested it in several ways however all failed, but in another project a code worked normally, but in my current one it did not. Can it be a logic or sequence error of the codes? I need to send the value of Byte
1 or 2, from Activity Main
to DemE
. Here is 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 Toast
to test whether values were being received, but the value was returned as null
.
Thank you!