If I try to pass data from one activity to another, but before going to another activity, I destroy the initial activity, then I cannot pass data. Look at the code
//set bundle to pass data from initial activity
bundle = new Bundle();
data1 = Double.valueOf(myEditText.getText().toString());
bundle.putDouble("data1", data1);
Intent intent = new Intent(this, AnotherActivity.class);
intent.putExtras(bundle);
startActivity(intent);
finish();
When I now try to get data in AnotherActivity via
myBundle = getIntent().getExtras();
I get nothing.
Is bundle in this case and instance variable? If so, that might be the problem. Try just creating a new bundle instance for this particular intent that you’re going to send.