After adding an object, you need to call one Activity (SizeDialog) twice to enter different parameters. The problem is that after the first call the data comes, and after the second there is no. Here is a simplified code cleared of everything superfluous:

protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case ACTIVITY_OBJECT: if (resultCode == RESULT_OK) { String selected_object = data.getStringExtra(GoodsListActivity.SELGOOD); addObject(selected_object); Intent intentSize = new Intent(this, SizeDialog.class); intentSize.putExtra("dialog_title", getResources().getString(R.string.object_width)); startActivityForResult(intentSize, ACTIVITY_WIDTH); } break; case ACTIVITY_WIDTH: if (resultCode == RESULT_OK) { int selectedObjectID = objects_list.getCheckedItemPosition(); if (selectedObjectID == -1) { return; } float width_value = data.getFloatExtra(SizeDialog.SIZEVALUE); SetObjectWidth(selectedObjectID, width_value); Intent intentSize = new Intent(this, SizeDialog.class); intentSize.putExtra("dialog_title", getResources().getString(R.string.object_height)); startActivityForResult(intentSize, ACTIVITY_HEIGHT); } break; case ACTIVITY_HEIGHT: if (resultCode == RESULT_OK) { int selectedObjectID = objects_list.getCheckedItemPosition(); if (selectedObjectID == -1) { return; } float height_value = data.getFloatExtra(SizeDialog.SIZEVALUE); SetObjectHeight(selectedObjectID, height_value); } break; } } 
  • If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky

1 answer 1

According to en-SO (the first line to issue a Google request

onactivityresult not called second

)

The problem is that the activation, which must return the result does not complete until it is called again. Therefore, you can solve the problem by forcibly stopping it by redefining its onStop() method:

 @Override protected void onStop() { finish(); super.onStop(); }