限制驱动器文件以选择android

时间:2016-04-11 07:01:04

标签: android file select android-sdcard drive

我想选择不同的格式文件上传到本地服务器。但我不想选择驱动器文件。这是我的代码,

private void showFileChooser(int position) {
        Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
        intent.setType("*/*");
        intent.addCategory(Intent.CATEGORY_OPENABLE);

        try {
            startActivityForResult(
                    Intent.createChooser(intent, "Select a File to Upload"), position);
        } catch (android.content.ActivityNotFoundException ex) {
            // Potentially direct the user to the Market with a Dialog
            Toast.makeText(this, "Please install a File Manager.",
                    Toast.LENGTH_SHORT).show();
        }
    } 

在此代码中,我选择了所有格式文件,这些文件也会打开我要删除的驱动器选项。

0 个答案:

没有答案