I use the following code to pass data between activities:
ActivityOne.class
Intent mIntent = new Intent(getBaseContext(), ActivityTwo.class); mIntent.putExtra("test", test_value); startActivityForResult(mIntent, 0); @Override protected void onActivityResult (int requestCode, int resultCode, Intent data) { Log.i(TAG, "Result: "+resultCode); // OK final String test_value = data.getExtras().getString("test"); // fails here since data is null Log.i(TAG, "Test: "+test_value); } ActivityTwo.class
@Override protected void onStart() { super.onStart(); ... setResult(result); // pass the result back to ActivityOne finish(); // yes, I close it immediately after start ;) So, how should I properly pass Intent data (test_value in the code above) from ActivityOne to ActivityTwo (this part works well) and then back to ActivityOne (this part doesn't work, data at onActivityResult is null)?