So my main Activity within the onOptionsItemSelected block has a settings option that when clicked, launches a settings activity and passes some values to it. The code looks like this
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
Intent intent = new Intent(this, SettingsActivity.class);
intent.putExtra("SettingsObj", settings);
intent.putExtra("UpdateDate", employees[0].updated);
startActivityForResult(intent, 1);
System.out.println("Did we return to the same instance????????????????");
AdjustSettings();
}
return super.onOptionsItemSelected(item);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1) {
if (resultCode == RESULT_OK) {
System.out.println("Did we get to this POINT????????");
settings = (Settings) data.getExtras().getSerializable("result");
System.out.println("What is the size of text? " + settings.TextSize);
}
}
}
Now the settings activity is called successfully and I pass back a Settings object afterwards. The Settings activity code passing back the value looks like this
@Override
public void onPause() {
returnIntent.putExtra("result", settings);
setResult(RESULT_OK, returnIntent);
finish();
super.onPause();
}
Now when i back out of the settings page, my main Activity does not resume at the next line printing out the question "Did we return?". The only print out code is what is at the beginning of the class. Does hitting the return arrow on my phone inside intent 2 not take me to the next line in intent 1 or is it a new instance of intent 1? Also, wasn't sure if i should return my intent data in the onPause or onStop :P Which is better? Thanks!