Search code examples
androidandroid-intentfile-manager

Open Default File Manager and rename file in android


I want to programatically launch a default file manager to show me the contents of a folder and I want delete or rename a file.

When I run android app.It show content of folder only, but cannot rename file.

how can i do it?

I'm using this code.

openButton.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
  Intent intent = new Intent();
  intent.setAction(Intent.ACTION_GET_CONTENT);
  intent.setType("file/*");
  startActivity(intent);
}
}

Thank you


Solution

  • I want to programatically launch a default file manager

    There is no "default file manager" on many Android devices. There is no requirement that any file manager respond to any particular Intent structure from third-party apps, other than MAIN/LAUNCHER for the launcher icon. And there is no requirement that any app allow the user to rename anything from an ACTION_GET_CONTENT activity.

    You will need to implement your desired functionality yourself, perhaps with the assistance of one of these libraries.