Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

大佬 请教个问题 #2

Closed
756230883 opened this issue Aug 5, 2022 · 6 comments
Closed

大佬 请教个问题 #2

756230883 opened this issue Aug 5, 2022 · 6 comments

Comments

@756230883
Copy link

val intent = Intent(Intent.ACTION_GET_CONTENT)
intent.setType("/")
intent.addCategory(Intent.CATEGORY_OPENABLE)
this.startActivityForResult(
Intent.createChooser(intent, "选择文件"),
FilePickerConst.REQUEST_CODE_ALL_TYPE

@756230883
Copy link
Author

上面那句代码 是项目里面打开 手机文件管理器的 为什么我原样复制到自己项目里 打开的效果 和您的这个项目打开的效果不一样呢 是还需要设置什么吗

@ITxiaoguang
Copy link
Owner

老铁,你复制少了两个 * 了,复制可不能马虎。
你这样试试

val intent = Intent(Intent.ACTION_GET_CONTENT)
intent.setType("*/*") //这里是  */* 
intent.addCategory(Intent.CATEGORY_OPENABLE)
this.startActivityForResult(
Intent.createChooser(intent, "选择文件"),
FilePickerConst.REQUEST_CODE_ALL_TYPE)

@756230883
Copy link
Author

不好意思大佬 我复制到这的时候 出错了

@756230883
Copy link
Author

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("/"); //这里是 /
intent.addCategory(Intent.CATEGORY_OPENABLE);
startActivityForResult(
Intent.createChooser(intent, "选择文件"),
3000);
这是我的代码 java的 您的项目打开 左边定位到的是“最近” 我用这段代码打开定位的是“我的手机

@756230883
Copy link
Author

e72bc00ab288204426bd895c16aa929
55b0e530f3227a4c309dbc6d62afde2

@ITxiaoguang
Copy link
Owner

你的代码在我这边直接提示 “没有应用可执行此操作”,你试试其他机型看看。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants