I'm getting a null value returned from getStringExtra at 1 of 3 occurrences. I see the value is present in the debugger with the correct key.
This is how I'm setting my extras:
Intent intent = new Intent(SettingsActivity.this, MainActivity.class);
intent.putExtra("citySearch", city.getText());
intent.putExtra("nDays", nDays.getSelectedItem().toString());
intent.putExtra("method", method.getSelectedItem().toString());
SettingsActivity.this.startActivity(intent);
And this is where I'm asking it back
Intent intent = getIntent();
String search = intent.getStringExtra("citySearch") == null ? "Maribor" : intent.getStringExtra("citySearch");
String nDays = intent.getStringExtra("nDays") == null ? "5" : intent.getStringExtra("nDays");
String method = intent.getStringExtra("method") == null ? "json" : intent.getStringExtra("method");
It's working for the "nDays" and the "method" but somehow not for the "citySearch". The value is always "Maribor", but I've debugged it and the value returned from the .getStringExtra()
is null.