2016-11-26 82 views
0

我想以编程方式启动默认文件管理器来向我显示文件夹的内容,并且我想要删除或重命名文件。在Android中打开默认文件管理器和重命名文件

当我运行android应用程序。它只显示文件夹的内容,但不能重命名文件。

我该怎么办?我正在使用此代码。

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); 
} 
} 

谢谢

+0

您是否在此处添加了写入文件管理器检查的权限http://stackoverflow.com/questions/2896733/how-to-rename-a-file-on-sdcard-with-android-application – Raju

回答

2

我想以编程方式启动默认的文件管理

没有 “默认文件管理器” 在许多Android设备。没有要求任何文件管理器响应来自第三方应用程序的任何特定Intent结构,而不是针对启动器图标的MAIN/LAUNCHER。并且没有要求任何应用程序允许用户重命名ACTION_GET_CONTENT活动中的任何内容。

您将需要自己实现所需的功能,可能需要one of these libraries的帮助。

相关问题