I am trying to get some data transferred inside my application using additional features.
I attach the data to the intent as follows:
Intent i = new Intent(ActivityFrom.this, ActivityTo.class);
i.putExtra(CONST_KEY, true);
startActivity(i);
FROM
public static final String CONST_KEY = "MyBooleanValue";
I am trying to get data in a running ActivityTo onCreate method as follows:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle extra = getIntent().getExtras();
if ( extra != null ) {
boolean b = extra.getBoolean(ActivityFrom.CONST_KEY);
}
}
However, I never come across an if-block, because Bundlealways null.
Why are my extras lost? What do I need to change to get the extra features that I set for myself?
Edit
source
share