public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case REQUEST_CHOOSER:
if (resultCode == Activity.RESULT_OK) {
final Uri uri = data.getData();
// Get the File path from the Uri
String path = FileUtils.getPath(this, uri);
// Alternatively, use FileUtils.getFile(Context, Uri)
if (path != null && FileUtils.isLocal(path)) {
File file = new File(path);
}
}
break;
}
}
我从 github 复制这段代码,这个链接https://github.com/iPaulPro/aFileChooser ,我把这段代码放在一个片段中。在这一行中,它显示错误
String path = FileUtils.getPath(this, uri);
显示此错误:
The method getPath(Context, Uri) in the type FileUtils is not applicable for the arguments (PagesFragment, Uri)
任何人都可以帮我解决这个问题吗?