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)
誰でもこの問題を解決するのを手伝ってくれますか?