I have just started coding in Android Studio and feeling Awesome..!!
How can I write a code for a \'Directory Picker\'. i.e., When a button is clicked, a simple Dialog/
Use below code to select directory
Intent result = new Intent();
result.putExtra("chosenDir", path);
setResult(RESULT_OK, result);
And to get the selected path override onActivityResult :
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == PICK_DIRECTORY && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();
String path = (String) extras.get("chosenDir");
}
}