Print

How to work with ES File Explorer

ES File Explorer provides intents PICK_FILE, PICK_DIRECTORY and extras for developers to present an "Open file", "Save file", or "Select folder".

  • Intent
Intent Action
com.estrongs.action.PICK_FILE Select a file
com.estrongs.action.PICK_DIRECTORY Select a directory
  • Extras
Extra Meaning
com.estrongs.intent.extra.BUTTON_TITLE Assign a new title, like Save or Open to the pick button
  • Example

This demo shows how the code works,download [apk], [src]

 

  • When you click the “Open a file” , the code is like:
Intent intent = new Intent("com.estrongs.action.PICK_FILE ");
intent.putExtra("com.estrongs.intent.extra.TITLE", “Open”);
…
startActivityForResult(intent, REQUEST_CODE_PICK_FILE_TO_SAVE);
…

Then the ES File Explorer will show, like:

When the button “Open” is clicked, the file selected is returned.

The selected file URI can be obtained in onActivityResult() through getData(), like:

case REQUEST_CODE_PICK_FILE_TO_OPEN:
// obtain the filename
if (uri != null) {
    Toast.makeText(this, getString(R.string.open_message) + " " + uri.getPath(), 0).show();
}    
break;

 

  • This is how to save file:

 

  • This is how to use a folder: