I'm trying to update a button's text by using an intent with a subactivity to debug why my player was throwing an exception, but it returns null until I call the subactivity again where it updates with the result of the first call.
Main Activity
public class MainActivity extends AppCompatActivity {
    static final int PICK_AUDIO_REQUEST = 1;
    String ResultPath;
    String path;
    String extStorageDirectory = Environment.getExternalStorageDirectory().toString();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        final Sound sound = new Sound(R.id.button,this);
        sound.button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                if(sound.mp == null){
                    Intent intent = new Intent(MainActivity.this, Pop.class);
                    startActivityForResult(intent, PICK_AUDIO_REQUEST);
                    //Pass audio file into sound
                    /*try {
                        sound.mp.setDataSource(path);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }*/
                }
                else if(sound.mp.isPlaying()) {
                    sound.mp.pause();
                }
                else{
                    sound.mp.seekTo(0);
                    sound.mp.start();
                }
            }
        });
    }
Subactivity
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
                                    long arg3) {
                Intent resultIntent = new Intent();
                resultIntent.putExtra("song path", mMusicList[arg2]);
                setResult(Activity.RESULT_OK, resultIntent);
                finish();
            }
        });
Example:
Subroutine is called and I select ring.wav from the popup
Afterwards, selecting ring.wav will not update the button with the correct path until you click on the button again.
onActivityResult
 @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        switch(requestCode) {
            case (PICK_AUDIO_REQUEST) : {
                if (resultCode == Activity.RESULT_OK) {
                    ResultPath = data.getStringExtra("song path");
                    path = extStorageDirectory + File.separator + ResultPath;
                }
                break;
            }
        }
    }
 
     
    