1

I have created a file explorer and a separate app with an editText to display some data. But how do I send the filepath back? I have stored the filepath in a string variable.

Mike Schwartz
  • 2,182
  • 1
  • 17
  • 26
AnishaJain
  • 233
  • 1
  • 2
  • 13

1 Answers1

1

You can use startActivityForResult:

Intent intent=new Intent(MainActivity.this,SecondActivity.class);  
startActivityForResult(intent, 2);// 

To pass result back :

 Intent returnIntent = new Intent();
 returnIntent.putExtra("result",path_string);
 setResult(RESULT_OK, returnIntent);     
 finish();

For more explanation, see the example

SweetWisher ツ
  • 7,296
  • 2
  • 30
  • 74